Sys.setenv(TZ="America/New_York")
#install.packages("tidyverse")
#install.packages("downloader")


library(dplyr); library(Hmisc); library(ggplot2); library(sjPlot); library(tidyverse); library(dplyr); library(stringr); library(downloader)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
## Loading required package: lattice
## Loading required package: survival
## Loading required package: Formula
## Loading required package: ggplot2
## 
## Attaching package: 'Hmisc'
## The following objects are masked from 'package:dplyr':
## 
##     src, summarize
## The following objects are masked from 'package:base':
## 
##     format.pval, units
## ── Attaching packages ────────────────────────────────── tidyverse 1.2.1 ──
## ✔ tibble  1.4.2     ✔ purrr   0.2.4
## ✔ tidyr   0.8.0     ✔ stringr 1.3.0
## ✔ readr   1.1.1     ✔ forcats 0.3.0
## ── Conflicts ───────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter()    masks stats::filter()
## ✖ dplyr::lag()       masks stats::lag()
## ✖ Hmisc::src()       masks dplyr::src()
## ✖ Hmisc::summarize() masks dplyr::summarize()
setwd("~/data/EICU/teresa_sepsis/")
spc <- read.csv("fuzzy_logic_score_first_day_v1_9_0_full.csv")  
ssd <- read.csv("sepsis_study_data_v1_9_1_full.csv") 
ap <- read.csv("apache_diagnosis_mapv2-2017-12-13.csv")

setwd("~/data/EICU/teresa_sepsis/5.0/")
ssd <- ssd %>% inner_join(spc,"patientunitstayid")

summary(ssd)
##  patientunitstayid exclusion_over18   exclusion_firstadmission
##  Min.   :      1   Min.   :0.000000   Min.   :0.0000          
##  1st Qu.: 761960   1st Qu.:0.000000   1st Qu.:0.0000          
##  Median :1597616   Median :0.000000   Median :0.0000          
##  Mean   :1647239   Mean   :0.004293   Mean   :0.1663          
##  3rd Qu.:2628874   3rd Qu.:0.000000   3rd Qu.:0.0000          
##  Max.   :3353271   Max.   :1.000000   Max.   :1.0000          
##                                                               
##  exclusion_yearfilter exclusion_apacheiva exclusion_vitalobservations
##  Min.   :0.0000       Min.   :0.000       Min.   :0.0000             
##  1st Qu.:0.0000       1st Qu.:0.000       1st Qu.:0.0000             
##  Median :0.0000       Median :0.000       Median :0.0000             
##  Mean   :0.2892       Mean   :0.378       Mean   :0.1026             
##  3rd Qu.:1.0000       3rd Qu.:1.000       3rd Qu.:0.0000             
##  Max.   :1.0000       Max.   :1.000       Max.   :1.0000             
##                                                                      
##  exclusion_labobservations exclusion_medobservations   hospitalid   
##  Min.   :0.00000           Min.   :0.0000            Min.   :  1.0  
##  1st Qu.:0.00000           1st Qu.:0.0000            1st Qu.:167.0  
##  Median :0.00000           Median :0.0000            Median :256.0  
##  Mean   :0.02638           Mean   :0.1508            Mean   :257.3  
##  3rd Qu.:0.00000           3rd Qu.:0.0000            3rd Qu.:365.0  
##  Max.   :1.00000           Max.   :1.0000            Max.   :459.0  
##                                                                     
##      gender             age                   ethnicity      
##         :   4896   Min.   : 0.00                   :  47920  
##  Female :1309647   1st Qu.:52.00   African American: 304105  
##  Male   :1527370   Median :65.00   Asian           :  45050  
##  Other  :     52   Mean   :62.72   Caucasian       :2152704  
##  Unknown:    556   3rd Qu.:76.00   Hispanic        : 145350  
##                    Max.   :90.00   Native American :  25711  
##                    NA's   :2061    Other/Unknown   : 121681  
##   hospital_los      hospital_size     hospital_type 
##  Min.   :-6378.81          : 643295   Mode:logical  
##  1st Qu.:    2.93   <100   : 141919   NA's:2842521  
##  Median :    5.72   100-249: 533513                 
##  Mean   :    8.94   250-500: 481826                 
##  3rd Qu.:   10.48   >500   :1041968                 
##  Max.   :36530.32                                   
##                                                     
##  hospital_teaching_status  hospital_region  
##   : 554798                         :632962  
##  f:1677818                Midwest  :753120  
##  t: 609905                Northeast:165767  
##                           South    :714254  
##                           West     :576418  
##                                             
##                                             
##  hospital_discharge_disposition hospital_mortality
##  Home         :1697524          Min.   :0.00      
##  SNF          : 320193          1st Qu.:0.00      
##  Death        : 264032          Median :0.00      
##  NursingHome  : 147773          Mean   :0.09      
##  Other        : 136520          3rd Qu.:0.00      
##  OtherExternal: 121664          Max.   :1.00      
##  (Other)      : 154815          NA's   :35521     
##  hospital_mortality_ultimate hospitaladmityear hospitaldischargeyear
##  Min.   :0.0                 Min.   :1913      Min.   :1987         
##  1st Qu.:0.0                 1st Qu.:2010      1st Qu.:2010         
##  Median :0.0                 Median :2012      Median :2012         
##  Mean   :0.1                 Mean   :2012      Mean   :2012         
##  3rd Qu.:0.0                 3rd Qu.:2014      3rd Qu.:2014         
##  Max.   :1.0                 Max.   :2016      Max.   :2016         
##  NA's   :405081                                                     
##     icu_los         icu_size               icu_type      
##  Min.   : -5.3382   Mode:logical   Med-Surg ICU:1527054  
##  1st Qu.:  0.8278   NA's:2842521   MICU        : 248339  
##  Median :  1.6104                  CCU-CTICU   : 227460  
##  Mean   :  2.7858                  Cardiac ICU : 192048  
##  3rd Qu.:  3.0500                  SICU        : 179514  
##  Max.   :824.2104                  Neuro ICU   : 164626  
##                                    (Other)     : 303480  
##              icu_admit_source              icu_disch_location 
##  Emergency Department:1245659   Floor               :1587711  
##  Floor               : 407519   Step-Down Unit (SDU): 291173  
##  Operating Room      : 367328   Home                : 250587  
##  ICU to SDU          : 188944   Death               : 154009  
##  Direct Admit        : 175631   Telemetry           : 152891  
##  Recovery Room       : 109083   Other ICU           : 129053  
##  (Other)             : 348357   (Other)             : 277097  
##  icu_mortality     admitsource     dischargelocation    bedcount     
##  Min.   :0.0000   Min.   :-1.0     Min.   :-1.0      Min.   :  1.0   
##  1st Qu.:0.0000   1st Qu.: 4.0     1st Qu.: 4.0      1st Qu.: 16.0   
##  Median :0.0000   Median : 8.0     Median : 4.0      Median : 22.0   
##  Mean   :0.0542   Mean   : 5.6     Mean   : 5.1      Mean   : 26.1   
##  3rd Qu.:0.0000   3rd Qu.: 8.0     3rd Qu.: 7.0      3rd Qu.: 31.0   
##  Max.   :1.0000   Max.   : 8.0     Max.   : 9.0      Max.   :252.0   
##  NA's   :644      NA's   :405081   NA's   :405081    NA's   :405081  
##     readmit         apacheiva      
##  Min.   :0.0      Min.   : -1.0    
##  1st Qu.:0.0      1st Qu.: 35.0    
##  Median :0.0      Median : 49.0    
##  Mean   :0.1      Mean   : 52.8    
##  3rd Qu.:0.0      3rd Qu.: 67.0    
##  Max.   :1.0      Max.   :230.0    
##  NA's   :405081   NA's   :1010706  
##                                    apacheadmissiondx      dialysis     
##                                             : 321341   Min.   :0       
##  Infarction, acute myocardial (MI)          : 108543   1st Qu.:0       
##  CHF, congestive heart failure              :  91037   Median :0       
##  Sepsis, pulmonary                          :  88361   Mean   :0       
##  CVA, cerebrovascular accident/stroke       :  82058   3rd Qu.:0       
##  CABG alone, coronary artery bypass grafting:  74389   Max.   :1       
##  (Other)                                    :2076792   NA's   :405081  
##       aids        hepaticfailure     cirrhosis         diabetes     
##  Min.   :0        Min.   :0        Min.   :0        Min.   :0.0     
##  1st Qu.:0        1st Qu.:0        1st Qu.:0        1st Qu.:0.0     
##  Median :0        Median :0        Median :0        Median :0.0     
##  Mean   :0        Mean   :0        Mean   :0        Mean   :0.2     
##  3rd Qu.:0        3rd Qu.:0        3rd Qu.:0        3rd Qu.:0.0     
##  Max.   :1        Max.   :1        Max.   :1        Max.   :1.0     
##  NA's   :405081   NA's   :405081   NA's   :405081   NA's   :405081  
##  immunosuppression    leukemia         lymphoma      metastaticcancer
##  Min.   :0         Min.   :0        Min.   :0        Min.   :0       
##  1st Qu.:0         1st Qu.:0        1st Qu.:0        1st Qu.:0       
##  Median :0         Median :0        Median :0        Median :0       
##  Mean   :0         Mean   :0        Mean   :0        Mean   :0       
##  3rd Qu.:0         3rd Qu.:0        3rd Qu.:0        3rd Qu.:0       
##  Max.   :1         Max.   :1        Max.   :1        Max.   :1       
##  NA's   :405081    NA's   :405081   NA's   :405081   NA's   :405081  
##  thrombolytics    admissionheight  admissionweight  chartedweight    
##  Min.   :0        Min.   :  0.0    Min.   :  0.0    Min.   : 30.0    
##  1st Qu.:0        1st Qu.:162.5    1st Qu.: 65.8    1st Qu.: 66.1    
##  Median :0        Median :170.0    Median : 79.4    Median : 80.0    
##  Mean   :0        Mean   :169.2    Mean   : 83.3    Mean   : 83.7    
##  3rd Qu.:0        3rd Qu.:177.8    3rd Qu.: 95.8    3rd Qu.: 96.8    
##  Max.   :1        Max.   :720.0    Max.   :993.8    Max.   :300.0    
##  NA's   :405081   NA's   :142941   NA's   :333094   NA's   :1494918  
##       eyes            motor            verbal            gcs        
##  Min.   :-1.0     Min.   :-1.0     Min.   :-1.0     Min.   :-3.0    
##  1st Qu.: 3.0     1st Qu.: 6.0     1st Qu.: 3.0     1st Qu.:11.0    
##  Median : 4.0     Median : 6.0     Median : 5.0     Median :15.0    
##  Mean   : 3.3     Mean   : 5.1     Mean   : 3.8     Mean   :12.2    
##  3rd Qu.: 4.0     3rd Qu.: 6.0     3rd Qu.: 5.0     3rd Qu.:15.0    
##  Max.   : 4.0     Max.   : 6.0     Max.   : 5.0     Max.   :15.0    
##  NA's   :405081   NA's   :405081   NA's   :405081   NA's   :405081  
##    unablegcs          urine           pao2_apache      fio2_apache    
##  Min.   :-1       Min.   :  -11556   Min.   : -1.0    Min.   : -1.0   
##  1st Qu.: 0       1st Qu.:      -1   1st Qu.: -1.0    1st Qu.: -1.0   
##  Median : 0       Median :       0   Median : -1.0    Median : -1.0   
##  Mean   : 0       Mean   :     965   Mean   : 29.5    Mean   : 12.8   
##  3rd Qu.: 0       3rd Qu.:    1519   3rd Qu.: -1.0    3rd Qu.: -1.0   
##  Max.   : 1       Max.   :21600000   Max.   :840.0    Max.   :100.0   
##  NA's   :405081   NA's   :405081     NA's   :405081   NA's   :405081  
##  pao2fio2_apache  temperature_apache respiratoryrate_apache
##  Min.   :  -1.0   Min.   :-1.0       Min.   :-1.0          
##  1st Qu.:  -1.0   1st Qu.:36.0       1st Qu.:10.0          
##  Median :  -1.0   Median :36.4       Median :25.0          
##  Mean   :  54.9   Mean   :32.6       Mean   :23.3          
##  3rd Qu.:  -1.0   3rd Qu.:36.7       3rd Qu.:34.0          
##  Max.   :2847.6   Max.   :43.0       Max.   :60.0          
##  NA's   :405081   NA's   :405081     NA's   :405081        
##  heartrate_apache   mbp_apache     albumin_apache   bilirubin_apache
##  Min.   : -1.0    Min.   : -1.0    Min.   :-1.0     Min.   :-1.0    
##  1st Qu.: 70.0    1st Qu.: 52.0    1st Qu.:-1.0     1st Qu.:-1.0    
##  Median :102.0    Median : 64.0    Median :-1.0     Median :-1.0    
##  Mean   : 97.1    Mean   : 82.3    Mean   : 0.5     Mean   :-0.2    
##  3rd Qu.:119.0    3rd Qu.:120.0    3rd Qu.: 2.6     3rd Qu.: 0.5    
##  Max.   :220.0    Max.   :200.0    Max.   : 8.6     Max.   :72.4    
##  NA's   :405081   NA's   :405081   NA's   :405081   NA's   :405081  
##    bun_apache     creatinine_apache glucose_apache   hematocrit_apache
##  Min.   : -1.0    Min.   :-1.0      Min.   :  -1.0   Min.   :-1.0     
##  1st Qu.:  6.0    1st Qu.: 0.4      1st Qu.:  85.0   1st Qu.:19.6     
##  Median : 15.0    Median : 0.8      Median : 118.0   Median :29.9     
##  Mean   : 20.2    Mean   : 1.0      Mean   : 142.3   Mean   :24.8     
##  3rd Qu.: 27.0    3rd Qu.: 1.4      3rd Qu.: 191.0   3rd Qu.:35.9     
##  Max.   :255.0    Max.   :25.0      Max.   :2954.0   Max.   :93.0     
##  NA's   :405081   NA's   :405081    NA's   :405081   NA's   :405081   
##  sodium_apache     paco2_apache      ph_apache      intubated_apache
##  Min.   : -1      Min.   : -1.0    Min.   :-1.0     Min.   :0.0     
##  1st Qu.:128      1st Qu.: -1.0    1st Qu.:-1.0     1st Qu.:0.0     
##  Median :136      Median : -1.0    Median :-1.0     Median :0.0     
##  Mean   :107      Mean   :  8.9    Mean   : 0.9     Mean   :0.1     
##  3rd Qu.:140      3rd Qu.: -1.0    3rd Qu.:-1.0     3rd Qu.:0.0     
##  Max.   :199      Max.   :150.0    Max.   : 8.6     Max.   :1.0     
##  NA's   :405081   NA's   :405081   NA's   :405081   NA's   :405081  
##    wbc_apache     oobintubday1_apache oobventday1_apache ventday1_apache 
##  Min.   : -1.0    Min.   :0.0         Min.   :0.0        Min.   :0.0     
##  1st Qu.: -1.0    1st Qu.:0.0         1st Qu.:0.0        1st Qu.:0.0     
##  Median :  8.2    Median :0.0         Median :0.0        Median :0.0     
##  Mean   :  8.7    Mean   :0.2         Mean   :0.3        Mean   :0.2     
##  3rd Qu.: 13.2    3rd Qu.:0.0         3rd Qu.:1.0        3rd Qu.:0.0     
##  Max.   :199.7    Max.   :1.0         Max.   :1.0        Max.   :1.0     
##  NA's   :405081   NA's   :405081      NA's   :405081     NA's   :405081  
##               physicianspeciality  acutephysiologyscore  apachescore     
##                         :1010706   Min.   : -1.0        Min.   : -1.0    
##  internal medicine      : 299354   1st Qu.: 25.0        1st Qu.: 35.0    
##  hospitalist            : 259993   Median : 37.0        Median : 49.0    
##  cardiology             : 166439   Mean   : 41.4        Mean   : 52.8    
##  pulmonary/CCM          : 143113   3rd Qu.: 53.0        3rd Qu.: 67.0    
##  Specialty Not Specified: 142045   Max.   :206.0        Max.   :230.0    
##  (Other)                : 820871   NA's   :1010706      NA's   :1010706  
##  predictedicumortality predictediculos   predictedhospitalmortality
##  Min.   :-1.0          Min.   :-1.0      Min.   :-1.0              
##  1st Qu.: 0.0          1st Qu.: 2.0      1st Qu.: 0.0              
##  Median : 0.0          Median : 3.2      Median : 0.0              
##  Mean   : 0.0          Mean   : 3.6      Mean   : 0.0              
##  3rd Qu.: 0.1          3rd Qu.: 5.0      3rd Qu.: 0.1              
##  Max.   : 1.0          Max.   :19.9      Max.   : 1.0              
##  NA's   :1010706       NA's   :1010706   NA's   :1010706           
##  predictedhospitallos    preopmi        preopcardiaccath 
##  Min.   : -1.0        Min.   :0         Min.   :0        
##  1st Qu.:  5.8        1st Qu.:0         1st Qu.:0        
##  Median :  8.8        Median :0         Median :0        
##  Mean   :  8.9        Mean   :0         Mean   :0        
##  3rd Qu.: 12.0        3rd Qu.:0         3rd Qu.:0        
##  Max.   :224.9        Max.   :1         Max.   :1        
##  NA's   :1010706      NA's   :1010706   NA's   :1010706  
##  ptcawithin24h       graftcount        mbp_min          sbp_min      
##  Min.   :0.0       Min.   : 1       Min.   :  1.0    Min.   :  1.0   
##  1st Qu.:0.0       1st Qu.: 3       1st Qu.: 48.0    1st Qu.: 50.0   
##  Median :0.0       Median : 3       Median : 59.0    Median : 60.0   
##  Mean   :0.1       Mean   : 3       Mean   : 58.5    Mean   : 60.4   
##  3rd Qu.:0.0       3rd Qu.: 3       3rd Qu.: 70.0    3rd Qu.: 71.0   
##  Max.   :1.0       Max.   :10       Max.   :360.0    Max.   :347.0   
##  NA's   :1010706   NA's   :405081   NA's   :355269   NA's   :355500  
##  temperature_min   temperature_max   heartrate_max    respiratoryrate_max
##  Min.   :  0.0     Min.   :  0.1     Min.   :  5.0    Min.   :    1.0    
##  1st Qu.: 35.0     1st Qu.: 37.3     1st Qu.: 91.0    1st Qu.:   24.0    
##  Median : 36.1     Median : 37.8     Median :105.0    Median :   28.0    
##  Mean   : 40.0     Mean   : 43.5     Mean   :106.9    Mean   :   32.1    
##  3rd Qu.: 36.9     3rd Qu.: 38.5     3rd Qu.:120.0    3rd Qu.:   35.0    
##  Max.   :137.0     Max.   :224.5     Max.   :300.0    Max.   :63017.0    
##  NA's   :2626885   NA's   :2626885   NA's   :308791   NA's   :461697     
##  heartrate_charted_max respiratoryrate_charted_max
##  Min.   :  1.0         Min.   : 1.0               
##  1st Qu.: 85.0         1st Qu.:20.0               
##  Median : 98.0         Median :25.0               
##  Mean   :100.4         Mean   :26.3               
##  3rd Qu.:114.0         3rd Qu.:30.0               
##  Max.   :387.0         Max.   :79.0               
##  NA's   :702383        NA's   :628438             
##  o2saturation_charted_min nibp_systolic_charted_min
##  Min.   :  0.5            Min.   :  1.0            
##  1st Qu.: 91.0            1st Qu.: 86.0            
##  Median : 94.0            Median : 99.0            
##  Mean   : 92.1            Mean   :100.6            
##  3rd Qu.: 96.0            3rd Qu.:114.0            
##  Max.   :100.0            Max.   :278.0            
##  NA's   :853531           NA's   :748024           
##  nibp_diastolic_charted_min nibp_mean_charted_min ibp_systolic_charted_min
##  Min.   :  1.0              Min.   :  0.1         Min.   :  1.0           
##  1st Qu.: 42.0              1st Qu.: 56.0         1st Qu.: 82.0           
##  Median : 51.0              Median : 66.0         Median : 95.0           
##  Mean   : 51.7              Mean   : 66.8         Mean   : 97.4           
##  3rd Qu.: 60.0              3rd Qu.: 77.0         3rd Qu.:111.0           
##  Max.   :235.0              Max.   :242.0         Max.   :390.0           
##  NA's   :746572             NA's   :837390        NA's   :2387420         
##  ibp_diastolic_charted_min ibp_mean_charted_min mbp_charted_min 
##  Min.   :  1.0             Min.   :  0.9        Min.   :  0.1   
##  1st Qu.: 41.0             1st Qu.: 56.0        1st Qu.: 55.0   
##  Median : 48.0             Median : 64.0        Median : 65.0   
##  Mean   : 48.8             Mean   : 65.4        Mean   : 65.8   
##  3rd Qu.: 56.0             3rd Qu.: 74.0        3rd Qu.: 76.0   
##  Max.   :390.0             Max.   :390.0        Max.   :359.0   
##  NA's   :2387543           NA's   :2360225      NA's   :743730  
##  sbp_charted_min  temperature_charted_min temperature_charted_max
##  Min.   :  1.0    Min.   :20.1            Min.   :21.0           
##  1st Qu.: 85.0    1st Qu.:36.1            1st Qu.:36.8           
##  Median : 98.0    Median :36.4            Median :37.1           
##  Mean   : 99.1    Mean   :36.3            Mean   :37.3           
##  3rd Qu.:113.0    3rd Qu.:36.7            3rd Qu.:37.6           
##  Max.   :264.0    Max.   :48.2            Max.   :49.3           
##  NA's   :702587   NA's   :483953          NA's   :483953         
##  gcs_charted_min   bilirubin_max     creatinine_max    lactate_min     
##  Min.   : 3.0      Min.   :  0.0     Min.   :  0.0    Min.   :  0.0    
##  1st Qu.:11.0      1st Qu.:  0.4     1st Qu.:  0.8    1st Qu.:  1.0    
##  Median :15.0      Median :  0.7     Median :  1.0    Median :  1.5    
##  Mean   :12.5      Mean   :  1.2     Mean   :  1.6    Mean   :  2.2    
##  3rd Qu.:15.0      3rd Qu.:  1.1     3rd Qu.:  1.6    3rd Qu.:  2.3    
##  Max.   :15.0      Max.   :198.0     Max.   :405.0    Max.   :557.0    
##  NA's   :1385494   NA's   :1769123   NA's   :457288   NA's   :2348514  
##   lactate_max         pao2_min          pao2_max         paco2_min      
##  Min.   :  0.0     Min.   :    0.0   Min.   :    0.0   Min.   :-104.0   
##  1st Qu.:  1.2     1st Qu.:   67.0   1st Qu.:   86.8   1st Qu.:  31.8   
##  Median :  1.9     Median :   84.0   Median :  126.0   Median :  37.0   
##  Mean   :  3.0     Mean   :  102.4   Mean   :  169.1   Mean   :  38.9   
##  3rd Qu.:  3.3     3rd Qu.:  115.0   3rd Qu.:  214.0   3rd Qu.:  43.3   
##  Max.   :557.0     Max.   :11830.0   Max.   :31109.0   Max.   :4560.0   
##  NA's   :2348514   NA's   :1914680   NA's   :1914680   NA's   :1918151  
##    paco2_max        platelet_min         inr_max           wbc_min      
##  Min.   :   0.0    Min.   :-99999.0   Min.   :  0.0     Min.   :  0.0   
##  1st Qu.:  36.0    1st Qu.:   138.0   1st Qu.:  1.1     1st Qu.:  7.3   
##  Median :  42.9    Median :   189.0   Median :  1.3     Median :  9.9   
##  Mean   :  45.9    Mean   :   201.2   Mean   :  1.6     Mean   : 11.3   
##  3rd Qu.:  51.0    3rd Qu.:   248.0   3rd Qu.:  1.6     3rd Qu.: 13.5   
##  Max.   :7572.0    Max.   :  3211.0   Max.   :130.0     Max.   :813.9   
##  NA's   :1918151   NA's   :555601     NA's   :1836686   NA's   :551423  
##     wbc_max            ptt_max          bands_max           ph_min       
##  Min.   :     0.0   Min.   :-180.0    Min.   :   0.0    Min.   :   -7.3  
##  1st Qu.:     7.9   1st Qu.:  28.9    1st Qu.:   3.0    1st Qu.:    7.3  
##  Median :    10.8   Median :  34.0    Median :   8.0    Median :    7.3  
##  Mean   :    12.6   Mean   :  45.3    Mean   :  12.9    Mean   :    7.6  
##  3rd Qu.:    14.9   3rd Qu.:  46.8    3rd Qu.:  18.0    3rd Qu.:    7.4  
##  Max.   :346000.0   Max.   :2935.0    Max.   :6424.0    Max.   :70566.0  
##  NA's   :551423     NA's   :2093556   NA's   :2610683   NA's   :1926604  
##  basedeficit_min   basedeficit_max      ast_max            alt_max        
##  Min.   :-30.0     Min.   :-30.0     Min.   :   -68.0   Min.   :  -645.0  
##  1st Qu.:  2.4     1st Qu.:  2.4     1st Qu.:    20.0   1st Qu.:    18.0  
##  Median :  4.8     Median :  4.8     Median :    32.0   Median :    29.0  
##  Mean   :  6.1     Mean   :  6.1     Mean   :   166.9   Mean   :   105.6  
##  3rd Qu.:  8.0     3rd Qu.:  8.0     3rd Qu.:    67.0   3rd Qu.:    51.0  
##  Max.   :405.0     Max.   :405.0     Max.   :787878.0   Max.   :474747.0  
##  NA's   :2698012   NA's   :2698012   NA's   :1745541    NA's   :1760955   
##     alp_max           penicilin      penicilin_anti_staph
##  Min.   :  -154.0   Min.   :0        Min.   :0           
##  1st Qu.:    59.0   1st Qu.:0        1st Qu.:0           
##  Median :    79.0   Median :0        Median :0           
##  Mean   :   107.4   Mean   :0        Mean   :0           
##  3rd Qu.:   111.0   3rd Qu.:0        3rd Qu.:0           
##  Max.   :868488.0   Max.   :1        Max.   :1           
##  NA's   :1770314    NA's   :472327   NA's   :472327      
##  penicilin_anti_pseudo augmentin_unasyn cephalosporin_1st_gen
##  Min.   :0.0           Min.   :0        Min.   :0            
##  1st Qu.:0.0           1st Qu.:0        1st Qu.:0            
##  Median :0.0           Median :0        Median :0            
##  Mean   :0.1           Mean   :0        Mean   :0            
##  3rd Qu.:0.0           3rd Qu.:0        3rd Qu.:0            
##  Max.   :1.0           Max.   :1        Max.   :1            
##  NA's   :472327        NA's   :472327   NA's   :472327       
##  cephalosporin_2nd_gen cephalosporin_3rd_gen cephalosporin_4th_5th_gen
##  Min.   :0             Min.   :0.0           Min.   :0                
##  1st Qu.:0             1st Qu.:0.0           1st Qu.:0                
##  Median :0             Median :0.0           Median :0                
##  Mean   :0             Mean   :0.1           Mean   :0                
##  3rd Qu.:0             3rd Qu.:0.0           3rd Qu.:0                
##  Max.   :1             Max.   :1.0           Max.   :1                
##  NA's   :472327        NA's   :472327        NA's   :472327           
##   carbapenems       monobactam           fq           vancomycin    
##  Min.   :0        Min.   :0        Min.   :0.0      Min.   :0.0     
##  1st Qu.:0        1st Qu.:0        1st Qu.:0.0      1st Qu.:0.0     
##  Median :0        Median :0        Median :0.0      Median :0.0     
##  Mean   :0        Mean   :0        Mean   :0.1      Mean   :0.2     
##  3rd Qu.:0        3rd Qu.:0        3rd Qu.:0.0      3rd Qu.:0.0     
##  Max.   :1        Max.   :1        Max.   :1.0      Max.   :1.0     
##  NA's   :472327   NA's   :472327   NA's   :472327   NA's   :472327  
##       amg           polymixins       linezolid          dapto       
##  Min.   :0        Min.   :0        Min.   :0        Min.   :0       
##  1st Qu.:0        1st Qu.:0        1st Qu.:0        1st Qu.:0       
##  Median :0        Median :0        Median :0        Median :0       
##  Mean   :0        Mean   :0        Mean   :0        Mean   :0       
##  3rd Qu.:0        3rd Qu.:0        3rd Qu.:0        3rd Qu.:0       
##  Max.   :1        Max.   :1        Max.   :1        Max.   :1       
##  NA's   :472327   NA's   :472327   NA's   :472327   NA's   :472327  
##      clinda         doxycyclin       macrolides         sulfa       
##  Min.   :0        Min.   :0        Min.   :0        Min.   :0       
##  1st Qu.:0        1st Qu.:0        1st Qu.:0        1st Qu.:0       
##  Median :0        Median :0        Median :0        Median :0       
##  Mean   :0        Mean   :0        Mean   :0        Mean   :0       
##  3rd Qu.:0        3rd Qu.:0        3rd Qu.:0        3rd Qu.:0       
##  Max.   :1        Max.   :1        Max.   :1        Max.   :1       
##  NA's   :472327   NA's   :472327   NA's   :472327   NA's   :472327  
##  metronidazole    nitrofurantoin    tigecycline      ceftriaxone    
##  Min.   :0        Min.   :0        Min.   :0        Min.   :0       
##  1st Qu.:0        1st Qu.:0        1st Qu.:0        1st Qu.:0       
##  Median :0        Median :0        Median :0        Median :0       
##  Mean   :0        Mean   :0        Mean   :0        Mean   :0       
##  3rd Qu.:0        3rd Qu.:0        3rd Qu.:0        3rd Qu.:0       
##  Max.   :1        Max.   :1        Max.   :1        Max.   :0       
##  NA's   :472327   NA's   :472327   NA's   :472327   NA's   :472327  
##    cefotaxime     ampicillin_sulbactam  levofloxacin     moxifloxacin   
##  Min.   :0        Min.   :0            Min.   :0        Min.   :0       
##  1st Qu.:0        1st Qu.:0            1st Qu.:0        1st Qu.:0       
##  Median :0        Median :0            Median :0        Median :0       
##  Mean   :0        Mean   :0            Mean   :0        Mean   :0       
##  3rd Qu.:0        3rd Qu.:0            3rd Qu.:0        3rd Qu.:0       
##  Max.   :0        Max.   :0            Max.   :1        Max.   :1       
##  NA's   :472327   NA's   :472327       NA's   :472327   NA's   :472327  
##  piperacillin_tazobactam    cefepim         meropenem     
##  Min.   :0               Min.   :0        Min.   :0       
##  1st Qu.:0               1st Qu.:0        1st Qu.:0       
##  Median :0               Median :0        Median :0       
##  Mean   :0               Mean   :0        Mean   :0       
##  3rd Qu.:0               3rd Qu.:0        3rd Qu.:0       
##  Max.   :0               Max.   :0        Max.   :0       
##  NA's   :472327          NA's   :472327   NA's   :472327  
##     imipenem        doripenem        gentamicin       tobramycin    
##  Min.   :0        Min.   :0        Min.   :0        Min.   :0       
##  1st Qu.:0        1st Qu.:0        1st Qu.:0        1st Qu.:0       
##  Median :0        Median :0        Median :0        Median :0       
##  Mean   :0        Mean   :0        Mean   :0        Mean   :0       
##  3rd Qu.:0        3rd Qu.:0        3rd Qu.:0        3rd Qu.:0       
##  Max.   :0        Max.   :0        Max.   :1        Max.   :1       
##  NA's   :472327   NA's   :472327   NA's   :472327   NA's   :472327  
##     amikacin      dopamine_infusion epinephrine_infusion
##  Min.   :0        Min.   :0.0       Min.   :0           
##  1st Qu.:0        1st Qu.:0.0       1st Qu.:0           
##  Median :0        Median :0.0       Median :0           
##  Mean   :0        Mean   :0.1       Mean   :0           
##  3rd Qu.:0        3rd Qu.:0.0       3rd Qu.:0           
##  Max.   :0        Max.   :1.0       Max.   :1           
##  NA's   :472327   NA's   :2005993   NA's   :2005993     
##  norepinephrine_infusion phenylephrine_infusion vasopressin_infusion
##  Min.   :0.0             Min.   :0.0            Min.   :0           
##  1st Qu.:0.0             1st Qu.:0.0            1st Qu.:0           
##  Median :0.0             Median :0.0            Median :0           
##  Mean   :0.2             Mean   :0.1            Mean   :0           
##  3rd Qu.:0.0             3rd Qu.:0.0            3rd Qu.:0           
##  Max.   :1.0             Max.   :1.0            Max.   :1           
##  NA's   :2005993         NA's   :2005993        NA's   :2005993     
##  milrinone_infusion heparin_infusion  dopamine_medication
##  Min.   :0          Min.   :0.0       Min.   :0.0        
##  1st Qu.:0          1st Qu.:0.0       1st Qu.:0.0        
##  Median :0          Median :0.0       Median :0.0        
##  Mean   :0          Mean   :0.1       Mean   :0.1        
##  3rd Qu.:0          3rd Qu.:0.0       3rd Qu.:0.0        
##  Max.   :1          Max.   :1.0       Max.   :1.0        
##  NA's   :2005993    NA's   :2005993   NA's   :472327     
##  epinephrine_medication norepinephrine_medication phenylephrine_medication
##  Min.   :0              Min.   :0.0               Min.   :0.0             
##  1st Qu.:0              1st Qu.:0.0               1st Qu.:0.0             
##  Median :0              Median :0.0               Median :0.0             
##  Mean   :0              Mean   :0.1               Mean   :0.1             
##  3rd Qu.:0              3rd Qu.:0.0               3rd Qu.:0.0             
##  Max.   :1              Max.   :1.0               Max.   :1.0             
##  NA's   :472327         NA's   :472327            NA's   :472327          
##  vasopressin_medication milrinone_medication heparin_medication
##  Min.   :0              Min.   :0            Min.   :0.0       
##  1st Qu.:0              1st Qu.:0            1st Qu.:0.0       
##  Median :0              Median :0            Median :0.0       
##  Mean   :0              Mean   :0            Mean   :0.2       
##  3rd Qu.:0              3rd Qu.:0            3rd Qu.:0.0       
##  Max.   :1              Max.   :1            Max.   :1.0       
##  NA's   :472327         NA's   :472327       NA's   :472327    
##      sepsis       sepsis_priority    infection      infection_priority
##  Min.   :0.0      Min.   :0.0      Min.   :0.0      Min.   :0.0       
##  1st Qu.:0.0      1st Qu.:0.0      1st Qu.:0.0      1st Qu.:0.0       
##  Median :0.0      Median :0.0      Median :0.0      Median :0.0       
##  Mean   :0.1      Mean   :0.2      Mean   :0.3      Mean   :0.5       
##  3rd Qu.:0.0      3rd Qu.:0.0      3rd Qu.:1.0      3rd Qu.:1.0       
##  Max.   :1.0      Max.   :3.0      Max.   :1.0      Max.   :3.0       
##  NA's   :451180   NA's   :451180   NA's   :451180   NA's   :451180    
##     aidshiv       aidshiv_priority  organfailure    organfailure_priority
##  Min.   :0        Min.   :0        Min.   :0.0      Min.   :0.0          
##  1st Qu.:0        1st Qu.:0        1st Qu.:0.0      1st Qu.:0.0          
##  Median :0        Median :0        Median :0.0      Median :0.0          
##  Mean   :0        Mean   :0        Mean   :0.4      Mean   :0.7          
##  3rd Qu.:0        3rd Qu.:0        3rd Qu.:1.0      3rd Qu.:1.0          
##  Max.   :1        Max.   :3        Max.   :1.0      Max.   :3.0          
##  NA's   :451180   NA's   :451180   NA's   :451180   NA's   :451180       
##  altered_mental_status altered_mental_status_priority infection_apache
##  Min.   :0.0           Min.   :0.0                    Min.   :0.0     
##  1st Qu.:0.0           1st Qu.:0.0                    1st Qu.:0.0     
##  Median :0.0           Median :0.0                    Median :0.0     
##  Mean   :0.1           Mean   :0.2                    Mean   :0.2     
##  3rd Qu.:0.0           3rd Qu.:0.0                    3rd Qu.:0.0     
##  Max.   :1.0           Max.   :3.0                    Max.   :1.0     
##  NA's   :451180        NA's   :451180                 NA's   :405081  
##  organfailure_apache prompt_inflam     prompt_severe_sepsis
##  Min.   :0.0         Min.   :0.0       Min.   :0.0         
##  1st Qu.:0.0         1st Qu.:0.0       1st Qu.:0.0         
##  Median :0.0         Median :0.0       Median :0.0         
##  Mean   :0.1         Mean   :0.2       Mean   :0.1         
##  3rd Qu.:0.0         3rd Qu.:0.0       3rd Qu.:0.0         
##  Max.   :1.0         Max.   :1.0       Max.   :1.0         
##  NA's   :405081      NA's   :2043713   NA's   :2043713     
##  prompt_sepsis     prompt_inflam_with_org_dys prompt_clinical_respone_req
##  Min.   :0         Min.   :0                  Min.   :0                  
##  1st Qu.:0         1st Qu.:0                  1st Qu.:1                  
##  Median :0         Median :0                  Median :1                  
##  Mean   :0         Mean   :0                  Mean   :1                  
##  3rd Qu.:0         3rd Qu.:0                  3rd Qu.:1                  
##  Max.   :1         Max.   :1                  Max.   :1                  
##  NA's   :2043713   NA's   :2043713            NA's   :2043713            
##  sofa_respiration sofa_coagulation   sofa_liver     sofa_cardiovascular
##  Min.   :0.0000   Min.   :0.0000   Min.   :0.0000   Min.   :0          
##  1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.:0          
##  Median :0.0000   Median :0.0000   Median :0.0000   Median :1          
##  Mean   :0.2906   Mean   :0.3582   Mean   :0.1393   Mean   :1          
##  3rd Qu.:0.0000   3rd Qu.:0.0000   3rd Qu.:0.0000   3rd Qu.:1          
##  Max.   :4.0000   Max.   :4.0000   Max.   :4.0000   Max.   :3          
##                                                                        
##     sofa_cns        sofa_renal     sofa_renal_baseline sofa_liver_baseline
##  Min.   :0.0000   Min.   :0.0000   Min.   :0.0000      Min.   :0.0000     
##  1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.:0.0000      1st Qu.:0.0000     
##  Median :0.0000   Median :0.0000   Median :0.0000      Median :0.0000     
##  Mean   :0.6754   Mean   :0.7193   Mean   :0.1244      Mean   :0.0704     
##  3rd Qu.:1.0000   3rd Qu.:1.0000   3rd Qu.:0.0000      3rd Qu.:0.0000     
##  Max.   :4.0000   Max.   :4.0000   Max.   :4.0000      Max.   :4.0000     
##                                                                           
##  sofa_respiration_baseline cardiovascular_baseline   soi_alpha      
##  Min.   :0.000             Min.   :0.0000          Min.   :2.5      
##  1st Qu.:0.000             1st Qu.:0.0000          1st Qu.:2.6      
##  Median :0.000             Median :0.0000          Median :2.8      
##  Mean   :0.403             Mean   :0.1942          Mean   :3.0      
##  3rd Qu.:0.000             3rd Qu.:0.0000          3rd Qu.:3.1      
##  Max.   :2.000             Max.   :1.0000          Max.   :8.0      
##                                                    NA's   :1172186  
##   soi_minutes         od_alpha        od_minutes     both_soi_alpha   
##  Min.   : -60.0    Min.   :1.0      Min.   : -60.0   Min.   :2.5      
##  1st Qu.:   0.0    1st Qu.:1.0      1st Qu.: -60.0   1st Qu.:2.6      
##  Median :  45.0    Median :1.0      Median :  20.0   Median :2.9      
##  Mean   : 196.7    Mean   :1.2      Mean   : 161.3   Mean   :3.1      
##  3rd Qu.: 265.0    3rd Qu.:1.0      3rd Qu.: 225.0   3rd Qu.:3.3      
##  Max.   :1440.0    Max.   :7.0      Max.   :1440.0   Max.   :9.0      
##  NA's   :1172186   NA's   :735024   NA's   :735024   NA's   :1523008  
##  both_od_alpha      both_minutes     soi_alteredmentalstatus
##  Min.   :1.0       Min.   : -60.0    Min.   :0              
##  1st Qu.:1.0       1st Qu.:   5.0    1st Qu.:0              
##  Median :1.0       Median :  80.0    Median :0              
##  Mean   :1.4       Mean   : 243.1    Mean   :0              
##  3rd Qu.:2.0       3rd Qu.: 375.0    3rd Qu.:0              
##  Max.   :7.0       Max.   :1440.0    Max.   :1              
##  NA's   :1523008   NA's   :1523008   NA's   :1172186        
##   soi_glucose      soi_heartrate        soi_inr        soi_respiratoryrate
##  Min.   :0.0       Min.   :0.0       Min.   :0.0       Min.   :0.0        
##  1st Qu.:0.0       1st Qu.:0.3       1st Qu.:0.0       1st Qu.:0.4        
##  Median :0.9       Median :0.9       Median :0.0       Median :0.8        
##  Mean   :0.6       Mean   :0.7       Mean   :0.2       Mean   :0.6        
##  3rd Qu.:1.0       3rd Qu.:1.0       3rd Qu.:0.0       3rd Qu.:1.0        
##  Max.   :1.0       Max.   :1.0       Max.   :1.0       Max.   :1.0        
##  NA's   :1172186   NA's   :1172186   NA's   :1172186   NA's   :1172186    
##  soi_temperature     soi_bands          soi_wbc         soi_lactate     
##  Min.   :0.0       Min.   :0.0       Min.   :0.0       Min.   :0.0      
##  1st Qu.:0.0       1st Qu.:0.0       1st Qu.:0.0       1st Qu.:0.0      
##  Median :0.0       Median :0.0       Median :0.6       Median :0.0      
##  Mean   :0.2       Mean   :0.1       Mean   :0.5       Mean   :0.1      
##  3rd Qu.:0.2       3rd Qu.:0.0       3rd Qu.:1.0       3rd Qu.:0.0      
##  Max.   :1.0       Max.   :1.0       Max.   :1.0       Max.   :1.0      
##  NA's   :1172186   NA's   :1172186   NA's   :1172186   NA's   :1172186  
##     od_liver      od_cardiovascular od_respiratory     od_kidney     
##  Min.   :0.0      Min.   :0.0       Min.   :0.0      Min.   :0.0     
##  1st Qu.:0.0      1st Qu.:0.0       1st Qu.:0.0      1st Qu.:0.0     
##  Median :0.0      Median :1.0       Median :0.0      Median :0.0     
##  Mean   :0.1      Mean   :0.6       Mean   :0.2      Mean   :0.1     
##  3rd Qu.:0.0      3rd Qu.:1.0       3rd Qu.:0.0      3rd Qu.:0.0     
##  Max.   :1.0      Max.   :1.0       Max.   :1.0      Max.   :1.0     
##  NA's   :735024   NA's   :735024    NA's   :735024   NA's   :735024  
##    od_lactate      od_metabolic    od_hematologic  
##  Min.   :0.0      Min.   :0.0      Min.   :0       
##  1st Qu.:0.0      1st Qu.:0.0      1st Qu.:0       
##  Median :0.0      Median :0.0      Median :0       
##  Mean   :0.1      Mean   :0.1      Mean   :0       
##  3rd Qu.:0.0      3rd Qu.:0.0      3rd Qu.:0       
##  Max.   :1.0      Max.   :1.0      Max.   :1       
##  NA's   :735024   NA's   :735024   NA's   :735024  
##  both_soi_alteredmentalstatus both_soi_glucose  both_soi_heartrate
##  Min.   :0                    Min.   :0.0       Min.   :0.0       
##  1st Qu.:0                    1st Qu.:0.0       1st Qu.:0.3       
##  Median :0                    Median :0.8       Median :0.9       
##  Mean   :0                    Mean   :0.6       Mean   :0.7       
##  3rd Qu.:0                    3rd Qu.:1.0       3rd Qu.:1.0       
##  Max.   :1                    Max.   :1.0       Max.   :1.0       
##  NA's   :1523008              NA's   :1523008   NA's   :1523008   
##   both_soi_inr     both_soi_respiratoryrate both_soi_temperature
##  Min.   :0.0       Min.   :0.0              Min.   :0.0         
##  1st Qu.:0.0       1st Qu.:0.4              1st Qu.:0.0         
##  Median :0.0       Median :0.8              Median :0.0         
##  Mean   :0.2       Mean   :0.6              Mean   :0.2         
##  3rd Qu.:0.2       3rd Qu.:1.0              3rd Qu.:0.2         
##  Max.   :1.0       Max.   :1.0              Max.   :1.0         
##  NA's   :1523008   NA's   :1523008          NA's   :1523008     
##  both_soi_bands     both_soi_wbc     both_soi_lactate  both_od_liver    
##  Min.   :0.0       Min.   :0.0       Min.   :0.0       Min.   :0.0      
##  1st Qu.:0.0       1st Qu.:0.0       1st Qu.:0.0       1st Qu.:0.0      
##  Median :0.0       Median :0.7       Median :0.0       Median :0.0      
##  Mean   :0.1       Mean   :0.6       Mean   :0.2       Mean   :0.2      
##  3rd Qu.:0.0       3rd Qu.:1.0       3rd Qu.:0.0       3rd Qu.:0.0      
##  Max.   :1.0       Max.   :1.0       Max.   :1.0       Max.   :1.0      
##  NA's   :1523008   NA's   :1523008   NA's   :1523008   NA's   :1523008  
##  both_od_cardiovascular both_od_respiratory both_od_kidney   
##  Min.   :0.0            Min.   :0.0         Min.   :0.0      
##  1st Qu.:0.0            1st Qu.:0.0         1st Qu.:0.0      
##  Median :1.0            Median :0.0         Median :0.0      
##  Mean   :0.5            Mean   :0.2         Mean   :0.1      
##  3rd Qu.:1.0            3rd Qu.:0.0         3rd Qu.:0.0      
##  Max.   :1.0            Max.   :1.0         Max.   :1.0      
##  NA's   :1523008        NA's   :1523008     NA's   :1523008  
##  both_od_lactate   both_od_metabolic both_od_hematologic
##  Min.   :0.0       Min.   :0.0       Min.   :0          
##  1st Qu.:0.0       1st Qu.:0.0       1st Qu.:0          
##  Median :0.0       Median :0.0       Median :0          
##  Mean   :0.2       Mean   :0.2       Mean   :0          
##  3rd Qu.:0.0       3rd Qu.:0.0       3rd Qu.:0          
##  Max.   :1.0       Max.   :1.0       Max.   :1          
##  NA's   :1523008   NA's   :1523008   NA's   :1523008
colnames(ssd)
##   [1] "patientunitstayid"              "exclusion_over18"              
##   [3] "exclusion_firstadmission"       "exclusion_yearfilter"          
##   [5] "exclusion_apacheiva"            "exclusion_vitalobservations"   
##   [7] "exclusion_labobservations"      "exclusion_medobservations"     
##   [9] "hospitalid"                     "gender"                        
##  [11] "age"                            "ethnicity"                     
##  [13] "hospital_los"                   "hospital_size"                 
##  [15] "hospital_type"                  "hospital_teaching_status"      
##  [17] "hospital_region"                "hospital_discharge_disposition"
##  [19] "hospital_mortality"             "hospital_mortality_ultimate"   
##  [21] "hospitaladmityear"              "hospitaldischargeyear"         
##  [23] "icu_los"                        "icu_size"                      
##  [25] "icu_type"                       "icu_admit_source"              
##  [27] "icu_disch_location"             "icu_mortality"                 
##  [29] "admitsource"                    "dischargelocation"             
##  [31] "bedcount"                       "readmit"                       
##  [33] "apacheiva"                      "apacheadmissiondx"             
##  [35] "dialysis"                       "aids"                          
##  [37] "hepaticfailure"                 "cirrhosis"                     
##  [39] "diabetes"                       "immunosuppression"             
##  [41] "leukemia"                       "lymphoma"                      
##  [43] "metastaticcancer"               "thrombolytics"                 
##  [45] "admissionheight"                "admissionweight"               
##  [47] "chartedweight"                  "eyes"                          
##  [49] "motor"                          "verbal"                        
##  [51] "gcs"                            "unablegcs"                     
##  [53] "urine"                          "pao2_apache"                   
##  [55] "fio2_apache"                    "pao2fio2_apache"               
##  [57] "temperature_apache"             "respiratoryrate_apache"        
##  [59] "heartrate_apache"               "mbp_apache"                    
##  [61] "albumin_apache"                 "bilirubin_apache"              
##  [63] "bun_apache"                     "creatinine_apache"             
##  [65] "glucose_apache"                 "hematocrit_apache"             
##  [67] "sodium_apache"                  "paco2_apache"                  
##  [69] "ph_apache"                      "intubated_apache"              
##  [71] "wbc_apache"                     "oobintubday1_apache"           
##  [73] "oobventday1_apache"             "ventday1_apache"               
##  [75] "physicianspeciality"            "acutephysiologyscore"          
##  [77] "apachescore"                    "predictedicumortality"         
##  [79] "predictediculos"                "predictedhospitalmortality"    
##  [81] "predictedhospitallos"           "preopmi"                       
##  [83] "preopcardiaccath"               "ptcawithin24h"                 
##  [85] "graftcount"                     "mbp_min"                       
##  [87] "sbp_min"                        "temperature_min"               
##  [89] "temperature_max"                "heartrate_max"                 
##  [91] "respiratoryrate_max"            "heartrate_charted_max"         
##  [93] "respiratoryrate_charted_max"    "o2saturation_charted_min"      
##  [95] "nibp_systolic_charted_min"      "nibp_diastolic_charted_min"    
##  [97] "nibp_mean_charted_min"          "ibp_systolic_charted_min"      
##  [99] "ibp_diastolic_charted_min"      "ibp_mean_charted_min"          
## [101] "mbp_charted_min"                "sbp_charted_min"               
## [103] "temperature_charted_min"        "temperature_charted_max"       
## [105] "gcs_charted_min"                "bilirubin_max"                 
## [107] "creatinine_max"                 "lactate_min"                   
## [109] "lactate_max"                    "pao2_min"                      
## [111] "pao2_max"                       "paco2_min"                     
## [113] "paco2_max"                      "platelet_min"                  
## [115] "inr_max"                        "wbc_min"                       
## [117] "wbc_max"                        "ptt_max"                       
## [119] "bands_max"                      "ph_min"                        
## [121] "basedeficit_min"                "basedeficit_max"               
## [123] "ast_max"                        "alt_max"                       
## [125] "alp_max"                        "penicilin"                     
## [127] "penicilin_anti_staph"           "penicilin_anti_pseudo"         
## [129] "augmentin_unasyn"               "cephalosporin_1st_gen"         
## [131] "cephalosporin_2nd_gen"          "cephalosporin_3rd_gen"         
## [133] "cephalosporin_4th_5th_gen"      "carbapenems"                   
## [135] "monobactam"                     "fq"                            
## [137] "vancomycin"                     "amg"                           
## [139] "polymixins"                     "linezolid"                     
## [141] "dapto"                          "clinda"                        
## [143] "doxycyclin"                     "macrolides"                    
## [145] "sulfa"                          "metronidazole"                 
## [147] "nitrofurantoin"                 "tigecycline"                   
## [149] "ceftriaxone"                    "cefotaxime"                    
## [151] "ampicillin_sulbactam"           "levofloxacin"                  
## [153] "moxifloxacin"                   "piperacillin_tazobactam"       
## [155] "cefepim"                        "meropenem"                     
## [157] "imipenem"                       "doripenem"                     
## [159] "gentamicin"                     "tobramycin"                    
## [161] "amikacin"                       "dopamine_infusion"             
## [163] "epinephrine_infusion"           "norepinephrine_infusion"       
## [165] "phenylephrine_infusion"         "vasopressin_infusion"          
## [167] "milrinone_infusion"             "heparin_infusion"              
## [169] "dopamine_medication"            "epinephrine_medication"        
## [171] "norepinephrine_medication"      "phenylephrine_medication"      
## [173] "vasopressin_medication"         "milrinone_medication"          
## [175] "heparin_medication"             "sepsis"                        
## [177] "sepsis_priority"                "infection"                     
## [179] "infection_priority"             "aidshiv"                       
## [181] "aidshiv_priority"               "organfailure"                  
## [183] "organfailure_priority"          "altered_mental_status"         
## [185] "altered_mental_status_priority" "infection_apache"              
## [187] "organfailure_apache"            "prompt_inflam"                 
## [189] "prompt_severe_sepsis"           "prompt_sepsis"                 
## [191] "prompt_inflam_with_org_dys"     "prompt_clinical_respone_req"   
## [193] "sofa_respiration"               "sofa_coagulation"              
## [195] "sofa_liver"                     "sofa_cardiovascular"           
## [197] "sofa_cns"                       "sofa_renal"                    
## [199] "sofa_renal_baseline"            "sofa_liver_baseline"           
## [201] "sofa_respiration_baseline"      "cardiovascular_baseline"       
## [203] "soi_alpha"                      "soi_minutes"                   
## [205] "od_alpha"                       "od_minutes"                    
## [207] "both_soi_alpha"                 "both_od_alpha"                 
## [209] "both_minutes"                   "soi_alteredmentalstatus"       
## [211] "soi_glucose"                    "soi_heartrate"                 
## [213] "soi_inr"                        "soi_respiratoryrate"           
## [215] "soi_temperature"                "soi_bands"                     
## [217] "soi_wbc"                        "soi_lactate"                   
## [219] "od_liver"                       "od_cardiovascular"             
## [221] "od_respiratory"                 "od_kidney"                     
## [223] "od_lactate"                     "od_metabolic"                  
## [225] "od_hematologic"                 "both_soi_alteredmentalstatus"  
## [227] "both_soi_glucose"               "both_soi_heartrate"            
## [229] "both_soi_inr"                   "both_soi_respiratoryrate"      
## [231] "both_soi_temperature"           "both_soi_bands"                
## [233] "both_soi_wbc"                   "both_soi_lactate"              
## [235] "both_od_liver"                  "both_od_cardiovascular"        
## [237] "both_od_respiratory"            "both_od_kidney"                
## [239] "both_od_lactate"                "both_od_metabolic"             
## [241] "both_od_hematologic"
nrow(ssd)
## [1] 2842521

1 Recoding of BMI, age, LOS, gender, ethnicity…

ssd <- ssd %>% mutate(patientweight = ifelse (is.na (chartedweight), (admissionweight),chartedweight))

ssd$BMI <- ssd$patientweight/((ssd$admissionheight/100)^2)
ssd$BMI_Ranges <- cut(ssd$BMI, c(0, 18.5, 25, 35, 200))
ssd <- ssd %>% mutate (BMI_Ranges=as.factor(if_else(is.na(BMI_Ranges),"Other/Unknown", as.character(BMI_Ranges))))
summary(ssd$BMI_Ranges, useNA = "ifany")
##      (0,18.5]     (18.5,25]       (25,35]      (35,200] Other/Unknown 
##        128213        753213       1191774        453265        316056
table(ssd$BMI_Ranges,useNA = "ifany")
## 
##      (0,18.5]     (18.5,25]       (25,35]      (35,200] Other/Unknown 
##        128213        753213       1191774        453265        316056
ssd$age_Ranges <- cut(ssd$age, c(0, 25, 35, 45, 55, 65, 75, 85, 100))
table(ssd$age_Ranges,useNA = "ifany")
## 
##   (0,25]  (25,35]  (35,45]  (45,55]  (55,65]  (65,75]  (75,85] (85,100] 
##   105109   141150   215032   421325   585296   621393   526359   224233 
##     <NA> 
##     2624
ssd%>%filter(is.na(age_Ranges))%>%select(age_Ranges, age)
##      age_Ranges age
## 1          <NA>  NA
## 2          <NA>   0
## 3          <NA>  NA
## 4          <NA>  NA
## 5          <NA>  NA
## 6          <NA>  NA
## 7          <NA>  NA
## 8          <NA>  NA
## 9          <NA>  NA
## 10         <NA>  NA
## 11         <NA>  NA
## 12         <NA>  NA
## 13         <NA>  NA
## 14         <NA>  NA
## 15         <NA>  NA
## 16         <NA>  NA
## 17         <NA>  NA
## 18         <NA>  NA
## 19         <NA>   0
## 20         <NA>  NA
## 21         <NA>  NA
## 22         <NA>  NA
## 23         <NA>  NA
## 24         <NA>  NA
## 25         <NA>  NA
## 26         <NA>  NA
## 27         <NA>  NA
## 28         <NA>  NA
## 29         <NA>  NA
## 30         <NA>  NA
## 31         <NA>  NA
## 32         <NA>  NA
## 33         <NA>  NA
## 34         <NA>   0
## 35         <NA>   0
## 36         <NA>  NA
## 37         <NA>  NA
## 38         <NA>  NA
## 39         <NA>   0
## 40         <NA>  NA
## 41         <NA>  NA
## 42         <NA>  NA
## 43         <NA>  NA
## 44         <NA>  NA
## 45         <NA>  NA
## 46         <NA>  NA
## 47         <NA>  NA
## 48         <NA>  NA
## 49         <NA>  NA
## 50         <NA>  NA
## 51         <NA>  NA
## 52         <NA>  NA
## 53         <NA>  NA
## 54         <NA>  NA
## 55         <NA>  NA
## 56         <NA>  NA
## 57         <NA>  NA
## 58         <NA>  NA
## 59         <NA>  NA
## 60         <NA>  NA
## 61         <NA>  NA
## 62         <NA>  NA
## 63         <NA>  NA
## 64         <NA>  NA
## 65         <NA>  NA
## 66         <NA>  NA
## 67         <NA>  NA
## 68         <NA>  NA
## 69         <NA>  NA
## 70         <NA>  NA
## 71         <NA>  NA
## 72         <NA>  NA
## 73         <NA>   0
## 74         <NA>   0
## 75         <NA>  NA
## 76         <NA>  NA
## 77         <NA>  NA
## 78         <NA>  NA
## 79         <NA>  NA
## 80         <NA>  NA
## 81         <NA>  NA
## 82         <NA>  NA
## 83         <NA>  NA
## 84         <NA>  NA
## 85         <NA>  NA
## 86         <NA>  NA
## 87         <NA>  NA
## 88         <NA>  NA
## 89         <NA>  NA
## 90         <NA>  NA
## 91         <NA>  NA
## 92         <NA>  NA
## 93         <NA>  NA
## 94         <NA>  NA
## 95         <NA>  NA
## 96         <NA>  NA
## 97         <NA>  NA
## 98         <NA>  NA
## 99         <NA>  NA
## 100        <NA>  NA
## 101        <NA>  NA
## 102        <NA>  NA
## 103        <NA>  NA
## 104        <NA>  NA
## 105        <NA>  NA
## 106        <NA>  NA
## 107        <NA>  NA
## 108        <NA>  NA
## 109        <NA>  NA
## 110        <NA>  NA
## 111        <NA>  NA
## 112        <NA>   0
## 113        <NA>   0
## 114        <NA>  NA
## 115        <NA>  NA
## 116        <NA>  NA
## 117        <NA>  NA
## 118        <NA>  NA
## 119        <NA>  NA
## 120        <NA>  NA
## 121        <NA>  NA
## 122        <NA>  NA
## 123        <NA>  NA
## 124        <NA>  NA
## 125        <NA>  NA
## 126        <NA>   0
## 127        <NA>   0
## 128        <NA>  NA
## 129        <NA>  NA
## 130        <NA>  NA
## 131        <NA>  NA
## 132        <NA>  NA
## 133        <NA>  NA
## 134        <NA>  NA
## 135        <NA>  NA
## 136        <NA>  NA
## 137        <NA>  NA
## 138        <NA>  NA
## 139        <NA>  NA
## 140        <NA>  NA
## 141        <NA>  NA
## 142        <NA>  NA
## 143        <NA>  NA
## 144        <NA>  NA
## 145        <NA>  NA
## 146        <NA>  NA
## 147        <NA>  NA
## 148        <NA>  NA
## 149        <NA>  NA
## 150        <NA>  NA
## 151        <NA>  NA
## 152        <NA>   0
## 153        <NA>  NA
## 154        <NA>  NA
## 155        <NA>  NA
## 156        <NA>  NA
## 157        <NA>  NA
## 158        <NA>  NA
## 159        <NA>  NA
## 160        <NA>   0
## 161        <NA>  NA
## 162        <NA>  NA
## 163        <NA>   0
## 164        <NA>  NA
## 165        <NA>  NA
## 166        <NA>  NA
## 167        <NA>  NA
## 168        <NA>  NA
## 169        <NA>  NA
## 170        <NA>  NA
## 171        <NA>  NA
## 172        <NA>  NA
## 173        <NA>  NA
## 174        <NA>  NA
## 175        <NA>  NA
## 176        <NA>  NA
## 177        <NA>   0
## 178        <NA>  NA
## 179        <NA>  NA
## 180        <NA>  NA
## 181        <NA>  NA
## 182        <NA>  NA
## 183        <NA>  NA
## 184        <NA>  NA
## 185        <NA>  NA
## 186        <NA>  NA
## 187        <NA>  NA
## 188        <NA>  NA
## 189        <NA>  NA
## 190        <NA>   0
## 191        <NA>  NA
## 192        <NA>  NA
## 193        <NA>  NA
## 194        <NA>  NA
## 195        <NA>  NA
## 196        <NA>  NA
## 197        <NA>  NA
## 198        <NA>  NA
## 199        <NA>  NA
## 200        <NA>  NA
## 201        <NA>  NA
## 202        <NA>  NA
## 203        <NA>  NA
## 204        <NA>  NA
## 205        <NA>  NA
## 206        <NA>  NA
## 207        <NA>  NA
## 208        <NA>  NA
## 209        <NA>  NA
## 210        <NA>  NA
## 211        <NA>  NA
## 212        <NA>  NA
## 213        <NA>  NA
## 214        <NA>  NA
## 215        <NA>  NA
## 216        <NA>  NA
## 217        <NA>  NA
## 218        <NA>  NA
## 219        <NA>  NA
## 220        <NA>  NA
## 221        <NA>  NA
## 222        <NA>   0
## 223        <NA>  NA
## 224        <NA>  NA
## 225        <NA>  NA
## 226        <NA>  NA
## 227        <NA>  NA
## 228        <NA>  NA
## 229        <NA>  NA
## 230        <NA>  NA
## 231        <NA>  NA
## 232        <NA>  NA
## 233        <NA>  NA
## 234        <NA>  NA
## 235        <NA>  NA
## 236        <NA>  NA
## 237        <NA>  NA
## 238        <NA>  NA
## 239        <NA>  NA
## 240        <NA>  NA
## 241        <NA>  NA
## 242        <NA>  NA
## 243        <NA>  NA
## 244        <NA>  NA
## 245        <NA>  NA
## 246        <NA>  NA
## 247        <NA>  NA
## 248        <NA>  NA
## 249        <NA>  NA
## 250        <NA>  NA
## 251        <NA>  NA
## 252        <NA>  NA
## 253        <NA>  NA
## 254        <NA>  NA
## 255        <NA>  NA
## 256        <NA>  NA
## 257        <NA>  NA
## 258        <NA>  NA
## 259        <NA>  NA
## 260        <NA>  NA
## 261        <NA>  NA
## 262        <NA>  NA
## 263        <NA>  NA
## 264        <NA>  NA
## 265        <NA>  NA
## 266        <NA>  NA
## 267        <NA>  NA
## 268        <NA>  NA
## 269        <NA>  NA
## 270        <NA>  NA
## 271        <NA>  NA
## 272        <NA>  NA
## 273        <NA>  NA
## 274        <NA>  NA
## 275        <NA>  NA
## 276        <NA>  NA
## 277        <NA>  NA
## 278        <NA>  NA
## 279        <NA>  NA
## 280        <NA>  NA
## 281        <NA>  NA
## 282        <NA>  NA
## 283        <NA>  NA
## 284        <NA>  NA
## 285        <NA>  NA
## 286        <NA>  NA
## 287        <NA>  NA
## 288        <NA>  NA
## 289        <NA>  NA
## 290        <NA>  NA
## 291        <NA>  NA
## 292        <NA>  NA
## 293        <NA>  NA
## 294        <NA>  NA
## 295        <NA>  NA
## 296        <NA>  NA
## 297        <NA>  NA
## 298        <NA>  NA
## 299        <NA>  NA
## 300        <NA>  NA
## 301        <NA>  NA
## 302        <NA>  NA
## 303        <NA>  NA
## 304        <NA>  NA
## 305        <NA>  NA
## 306        <NA>  NA
## 307        <NA>  NA
## 308        <NA>  NA
## 309        <NA>  NA
## 310        <NA>  NA
## 311        <NA>  NA
## 312        <NA>  NA
## 313        <NA>  NA
## 314        <NA>  NA
## 315        <NA>  NA
## 316        <NA>  NA
## 317        <NA>  NA
## 318        <NA>  NA
## 319        <NA>  NA
## 320        <NA>  NA
## 321        <NA>  NA
## 322        <NA>  NA
## 323        <NA>  NA
## 324        <NA>  NA
## 325        <NA>  NA
## 326        <NA>  NA
## 327        <NA>  NA
## 328        <NA>  NA
## 329        <NA>  NA
## 330        <NA>  NA
## 331        <NA>  NA
## 332        <NA>  NA
## 333        <NA>  NA
## 334        <NA>  NA
## 335        <NA>  NA
## 336        <NA>   0
## 337        <NA>  NA
## 338        <NA>  NA
## 339        <NA>  NA
## 340        <NA>  NA
## 341        <NA>  NA
## 342        <NA>  NA
## 343        <NA>  NA
## 344        <NA>  NA
## 345        <NA>  NA
## 346        <NA>  NA
## 347        <NA>  NA
## 348        <NA>  NA
## 349        <NA>  NA
## 350        <NA>  NA
## 351        <NA>  NA
## 352        <NA>  NA
## 353        <NA>  NA
## 354        <NA>   0
## 355        <NA>  NA
## 356        <NA>  NA
## 357        <NA>  NA
## 358        <NA>   0
## 359        <NA>  NA
## 360        <NA>  NA
## 361        <NA>  NA
## 362        <NA>  NA
## 363        <NA>  NA
## 364        <NA>  NA
## 365        <NA>  NA
## 366        <NA>  NA
## 367        <NA>  NA
## 368        <NA>  NA
## 369        <NA>   0
## 370        <NA>  NA
## 371        <NA>  NA
## 372        <NA>  NA
## 373        <NA>  NA
## 374        <NA>  NA
## 375        <NA>  NA
## 376        <NA>  NA
## 377        <NA>  NA
## 378        <NA>  NA
## 379        <NA>  NA
## 380        <NA>  NA
## 381        <NA>  NA
## 382        <NA>  NA
## 383        <NA>  NA
## 384        <NA>  NA
## 385        <NA>  NA
## 386        <NA>  NA
## 387        <NA>  NA
## 388        <NA>  NA
## 389        <NA>  NA
## 390        <NA>  NA
## 391        <NA>  NA
## 392        <NA>  NA
## 393        <NA>   0
## 394        <NA>   0
## 395        <NA>  NA
## 396        <NA>  NA
## 397        <NA>  NA
## 398        <NA>  NA
## 399        <NA>  NA
## 400        <NA>  NA
## 401        <NA>  NA
## 402        <NA>  NA
## 403        <NA>  NA
## 404        <NA>  NA
## 405        <NA>  NA
## 406        <NA>  NA
## 407        <NA>  NA
## 408        <NA>  NA
## 409        <NA>  NA
## 410        <NA>  NA
## 411        <NA>  NA
## 412        <NA>  NA
## 413        <NA>  NA
## 414        <NA>  NA
## 415        <NA>  NA
## 416        <NA>  NA
## 417        <NA>  NA
## 418        <NA>  NA
## 419        <NA>  NA
## 420        <NA>  NA
## 421        <NA>  NA
## 422        <NA>  NA
## 423        <NA>  NA
## 424        <NA>  NA
## 425        <NA>  NA
## 426        <NA>  NA
## 427        <NA>  NA
## 428        <NA>  NA
## 429        <NA>  NA
## 430        <NA>  NA
## 431        <NA>  NA
## 432        <NA>  NA
## 433        <NA>   0
## 434        <NA>  NA
## 435        <NA>   0
## 436        <NA>  NA
## 437        <NA>  NA
## 438        <NA>  NA
## 439        <NA>  NA
## 440        <NA>  NA
## 441        <NA>  NA
## 442        <NA>  NA
## 443        <NA>  NA
## 444        <NA>  NA
## 445        <NA>  NA
## 446        <NA>  NA
## 447        <NA>  NA
## 448        <NA>  NA
## 449        <NA>  NA
## 450        <NA>   0
## 451        <NA>   0
## 452        <NA>   0
## 453        <NA>  NA
## 454        <NA>  NA
## 455        <NA>  NA
## 456        <NA>  NA
## 457        <NA>  NA
## 458        <NA>   0
## 459        <NA>  NA
## 460        <NA>  NA
## 461        <NA>  NA
## 462        <NA>  NA
## 463        <NA>  NA
## 464        <NA>  NA
## 465        <NA>  NA
## 466        <NA>  NA
## 467        <NA>  NA
## 468        <NA>  NA
## 469        <NA>  NA
## 470        <NA>  NA
## 471        <NA>  NA
## 472        <NA>  NA
## 473        <NA>  NA
## 474        <NA>  NA
## 475        <NA>  NA
## 476        <NA>  NA
## 477        <NA>  NA
## 478        <NA>  NA
## 479        <NA>  NA
## 480        <NA>  NA
## 481        <NA>  NA
## 482        <NA>  NA
## 483        <NA>  NA
## 484        <NA>  NA
## 485        <NA>  NA
## 486        <NA>  NA
## 487        <NA>  NA
## 488        <NA>  NA
## 489        <NA>  NA
## 490        <NA>  NA
## 491        <NA>  NA
## 492        <NA>  NA
## 493        <NA>  NA
## 494        <NA>  NA
## 495        <NA>  NA
## 496        <NA>  NA
## 497        <NA>  NA
## 498        <NA>  NA
## 499        <NA>  NA
## 500        <NA>  NA
## 501        <NA>  NA
## 502        <NA>  NA
## 503        <NA>  NA
## 504        <NA>  NA
## 505        <NA>  NA
## 506        <NA>  NA
## 507        <NA>  NA
## 508        <NA>  NA
## 509        <NA>  NA
## 510        <NA>  NA
## 511        <NA>  NA
## 512        <NA>  NA
## 513        <NA>  NA
## 514        <NA>  NA
## 515        <NA>  NA
## 516        <NA>  NA
## 517        <NA>  NA
## 518        <NA>   0
## 519        <NA>  NA
## 520        <NA>  NA
## 521        <NA>  NA
## 522        <NA>  NA
## 523        <NA>  NA
## 524        <NA>  NA
## 525        <NA>  NA
## 526        <NA>  NA
## 527        <NA>  NA
## 528        <NA>  NA
## 529        <NA>  NA
## 530        <NA>  NA
## 531        <NA>  NA
## 532        <NA>  NA
## 533        <NA>  NA
## 534        <NA>  NA
## 535        <NA>  NA
## 536        <NA>  NA
## 537        <NA>  NA
## 538        <NA>  NA
## 539        <NA>  NA
## 540        <NA>  NA
## 541        <NA>  NA
## 542        <NA>  NA
## 543        <NA>  NA
## 544        <NA>  NA
## 545        <NA>  NA
## 546        <NA>  NA
## 547        <NA>  NA
## 548        <NA>  NA
## 549        <NA>   0
## 550        <NA>   0
## 551        <NA>  NA
## 552        <NA>  NA
## 553        <NA>  NA
## 554        <NA>  NA
## 555        <NA>   0
## 556        <NA>   0
## 557        <NA>   0
## 558        <NA>  NA
## 559        <NA>  NA
## 560        <NA>  NA
## 561        <NA>   0
## 562        <NA>  NA
## 563        <NA>  NA
## 564        <NA>   0
## 565        <NA>  NA
## 566        <NA>  NA
## 567        <NA>  NA
## 568        <NA>  NA
## 569        <NA>   0
## 570        <NA>   0
## 571        <NA>  NA
## 572        <NA>  NA
## 573        <NA>   0
## 574        <NA>  NA
## 575        <NA>  NA
## 576        <NA>   0
## 577        <NA>  NA
## 578        <NA>  NA
## 579        <NA>  NA
## 580        <NA>  NA
## 581        <NA>  NA
## 582        <NA>  NA
## 583        <NA>  NA
## 584        <NA>  NA
## 585        <NA>  NA
## 586        <NA>  NA
## 587        <NA>   0
## 588        <NA>  NA
## 589        <NA>  NA
## 590        <NA>   0
## 591        <NA>  NA
## 592        <NA>  NA
## 593        <NA>   0
## 594        <NA>  NA
## 595        <NA>  NA
## 596        <NA>  NA
## 597        <NA>  NA
## 598        <NA>  NA
## 599        <NA>  NA
## 600        <NA>  NA
## 601        <NA>  NA
## 602        <NA>  NA
## 603        <NA>  NA
## 604        <NA>  NA
## 605        <NA>  NA
## 606        <NA>  NA
## 607        <NA>  NA
## 608        <NA>  NA
## 609        <NA>  NA
## 610        <NA>  NA
## 611        <NA>  NA
## 612        <NA>  NA
## 613        <NA>  NA
## 614        <NA>  NA
## 615        <NA>  NA
## 616        <NA>  NA
## 617        <NA>  NA
## 618        <NA>  NA
## 619        <NA>  NA
## 620        <NA>  NA
## 621        <NA>  NA
## 622        <NA>  NA
## 623        <NA>  NA
## 624        <NA>  NA
## 625        <NA>  NA
## 626        <NA>  NA
## 627        <NA>  NA
## 628        <NA>  NA
## 629        <NA>  NA
## 630        <NA>  NA
## 631        <NA>  NA
## 632        <NA>  NA
## 633        <NA>  NA
## 634        <NA>  NA
## 635        <NA>  NA
## 636        <NA>  NA
## 637        <NA>  NA
## 638        <NA>  NA
## 639        <NA>  NA
## 640        <NA>  NA
## 641        <NA>  NA
## 642        <NA>  NA
## 643        <NA>  NA
## 644        <NA>  NA
## 645        <NA>  NA
## 646        <NA>  NA
## 647        <NA>  NA
## 648        <NA>  NA
## 649        <NA>  NA
## 650        <NA>  NA
## 651        <NA>  NA
## 652        <NA>  NA
## 653        <NA>  NA
## 654        <NA>  NA
## 655        <NA>  NA
## 656        <NA>  NA
## 657        <NA>  NA
## 658        <NA>  NA
## 659        <NA>  NA
## 660        <NA>  NA
## 661        <NA>  NA
## 662        <NA>  NA
## 663        <NA>  NA
## 664        <NA>  NA
## 665        <NA>  NA
## 666        <NA>  NA
## 667        <NA>  NA
## 668        <NA>  NA
## 669        <NA>  NA
## 670        <NA>  NA
## 671        <NA>  NA
## 672        <NA>  NA
## 673        <NA>  NA
## 674        <NA>  NA
## 675        <NA>  NA
## 676        <NA>  NA
## 677        <NA>  NA
## 678        <NA>  NA
## 679        <NA>  NA
## 680        <NA>  NA
## 681        <NA>  NA
## 682        <NA>  NA
## 683        <NA>  NA
## 684        <NA>  NA
## 685        <NA>  NA
## 686        <NA>  NA
## 687        <NA>  NA
## 688        <NA>  NA
## 689        <NA>  NA
## 690        <NA>  NA
## 691        <NA>  NA
## 692        <NA>  NA
## 693        <NA>  NA
## 694        <NA>  NA
## 695        <NA>  NA
## 696        <NA>  NA
## 697        <NA>  NA
## 698        <NA>  NA
## 699        <NA>  NA
## 700        <NA>  NA
## 701        <NA>  NA
## 702        <NA>  NA
## 703        <NA>  NA
## 704        <NA>  NA
## 705        <NA>  NA
## 706        <NA>  NA
## 707        <NA>  NA
## 708        <NA>  NA
## 709        <NA>  NA
## 710        <NA>  NA
## 711        <NA>  NA
## 712        <NA>  NA
## 713        <NA>  NA
## 714        <NA>  NA
## 715        <NA>  NA
## 716        <NA>  NA
## 717        <NA>  NA
## 718        <NA>  NA
## 719        <NA>  NA
## 720        <NA>  NA
## 721        <NA>  NA
## 722        <NA>  NA
## 723        <NA>  NA
## 724        <NA>  NA
## 725        <NA>  NA
## 726        <NA>  NA
## 727        <NA>  NA
## 728        <NA>  NA
## 729        <NA>  NA
## 730        <NA>  NA
## 731        <NA>  NA
## 732        <NA>  NA
## 733        <NA>  NA
## 734        <NA>  NA
## 735        <NA>  NA
## 736        <NA>  NA
## 737        <NA>  NA
## 738        <NA>  NA
## 739        <NA>  NA
## 740        <NA>  NA
## 741        <NA>  NA
## 742        <NA>  NA
## 743        <NA>  NA
## 744        <NA>  NA
## 745        <NA>  NA
## 746        <NA>  NA
## 747        <NA>  NA
## 748        <NA>  NA
## 749        <NA>  NA
## 750        <NA>  NA
## 751        <NA>  NA
## 752        <NA>  NA
## 753        <NA>  NA
## 754        <NA>  NA
## 755        <NA>  NA
## 756        <NA>  NA
## 757        <NA>  NA
## 758        <NA>  NA
## 759        <NA>  NA
## 760        <NA>  NA
## 761        <NA>  NA
## 762        <NA>  NA
## 763        <NA>  NA
## 764        <NA>  NA
## 765        <NA>  NA
## 766        <NA>  NA
## 767        <NA>  NA
## 768        <NA>  NA
## 769        <NA>  NA
## 770        <NA>  NA
## 771        <NA>  NA
## 772        <NA>  NA
## 773        <NA>  NA
## 774        <NA>  NA
## 775        <NA>  NA
## 776        <NA>  NA
## 777        <NA>  NA
## 778        <NA>  NA
## 779        <NA>  NA
## 780        <NA>  NA
## 781        <NA>  NA
## 782        <NA>  NA
## 783        <NA>  NA
## 784        <NA>  NA
## 785        <NA>  NA
## 786        <NA>  NA
## 787        <NA>  NA
## 788        <NA>  NA
## 789        <NA>  NA
## 790        <NA>  NA
## 791        <NA>  NA
## 792        <NA>  NA
## 793        <NA>  NA
## 794        <NA>  NA
## 795        <NA>  NA
## 796        <NA>  NA
## 797        <NA>  NA
## 798        <NA>  NA
## 799        <NA>  NA
## 800        <NA>  NA
## 801        <NA>  NA
## 802        <NA>  NA
## 803        <NA>  NA
## 804        <NA>  NA
## 805        <NA>  NA
## 806        <NA>  NA
## 807        <NA>  NA
## 808        <NA>  NA
## 809        <NA>  NA
## 810        <NA>  NA
## 811        <NA>  NA
## 812        <NA>  NA
## 813        <NA>  NA
## 814        <NA>  NA
## 815        <NA>  NA
## 816        <NA>  NA
## 817        <NA>  NA
## 818        <NA>  NA
## 819        <NA>  NA
## 820        <NA>  NA
## 821        <NA>  NA
## 822        <NA>  NA
## 823        <NA>  NA
## 824        <NA>  NA
## 825        <NA>  NA
## 826        <NA>  NA
## 827        <NA>  NA
## 828        <NA>  NA
## 829        <NA>  NA
## 830        <NA>  NA
## 831        <NA>  NA
## 832        <NA>  NA
## 833        <NA>  NA
## 834        <NA>  NA
## 835        <NA>  NA
## 836        <NA>  NA
## 837        <NA>  NA
## 838        <NA>  NA
## 839        <NA>  NA
## 840        <NA>  NA
## 841        <NA>  NA
## 842        <NA>  NA
## 843        <NA>  NA
## 844        <NA>  NA
## 845        <NA>  NA
## 846        <NA>  NA
## 847        <NA>  NA
## 848        <NA>  NA
## 849        <NA>  NA
## 850        <NA>  NA
## 851        <NA>  NA
## 852        <NA>  NA
## 853        <NA>  NA
## 854        <NA>  NA
## 855        <NA>  NA
## 856        <NA>  NA
## 857        <NA>  NA
## 858        <NA>  NA
## 859        <NA>  NA
## 860        <NA>  NA
## 861        <NA>  NA
## 862        <NA>  NA
## 863        <NA>  NA
## 864        <NA>  NA
## 865        <NA>  NA
## 866        <NA>  NA
## 867        <NA>  NA
## 868        <NA>  NA
## 869        <NA>  NA
## 870        <NA>  NA
## 871        <NA>  NA
## 872        <NA>  NA
## 873        <NA>  NA
## 874        <NA>  NA
## 875        <NA>  NA
## 876        <NA>  NA
## 877        <NA>  NA
## 878        <NA>  NA
## 879        <NA>  NA
## 880        <NA>  NA
## 881        <NA>  NA
## 882        <NA>  NA
## 883        <NA>  NA
## 884        <NA>  NA
## 885        <NA>  NA
## 886        <NA>  NA
## 887        <NA>  NA
## 888        <NA>  NA
## 889        <NA>  NA
## 890        <NA>  NA
## 891        <NA>  NA
## 892        <NA>  NA
## 893        <NA>  NA
## 894        <NA>  NA
## 895        <NA>  NA
## 896        <NA>  NA
## 897        <NA>  NA
## 898        <NA>  NA
## 899        <NA>  NA
## 900        <NA>  NA
## 901        <NA>  NA
## 902        <NA>  NA
## 903        <NA>  NA
## 904        <NA>  NA
## 905        <NA>  NA
## 906        <NA>  NA
## 907        <NA>  NA
## 908        <NA>  NA
## 909        <NA>  NA
## 910        <NA>  NA
## 911        <NA>  NA
## 912        <NA>  NA
## 913        <NA>  NA
## 914        <NA>  NA
## 915        <NA>  NA
## 916        <NA>  NA
## 917        <NA>  NA
## 918        <NA>  NA
## 919        <NA>  NA
## 920        <NA>  NA
## 921        <NA>  NA
## 922        <NA>  NA
## 923        <NA>  NA
## 924        <NA>  NA
## 925        <NA>  NA
## 926        <NA>  NA
## 927        <NA>  NA
## 928        <NA>  NA
## 929        <NA>  NA
## 930        <NA>  NA
## 931        <NA>  NA
## 932        <NA>  NA
## 933        <NA>  NA
## 934        <NA>  NA
## 935        <NA>  NA
## 936        <NA>  NA
## 937        <NA>  NA
## 938        <NA>  NA
## 939        <NA>  NA
## 940        <NA>  NA
## 941        <NA>  NA
## 942        <NA>  NA
## 943        <NA>  NA
## 944        <NA>  NA
## 945        <NA>  NA
## 946        <NA>  NA
## 947        <NA>  NA
## 948        <NA>  NA
## 949        <NA>  NA
## 950        <NA>  NA
## 951        <NA>  NA
## 952        <NA>  NA
## 953        <NA>  NA
## 954        <NA>  NA
## 955        <NA>  NA
## 956        <NA>  NA
## 957        <NA>  NA
## 958        <NA>  NA
## 959        <NA>  NA
## 960        <NA>  NA
## 961        <NA>  NA
## 962        <NA>  NA
## 963        <NA>  NA
## 964        <NA>  NA
## 965        <NA>  NA
## 966        <NA>  NA
## 967        <NA>  NA
## 968        <NA>  NA
## 969        <NA>  NA
## 970        <NA>  NA
## 971        <NA>  NA
## 972        <NA>  NA
## 973        <NA>  NA
## 974        <NA>  NA
## 975        <NA>  NA
## 976        <NA>  NA
## 977        <NA>  NA
## 978        <NA>  NA
## 979        <NA>  NA
## 980        <NA>  NA
## 981        <NA>  NA
## 982        <NA>  NA
## 983        <NA>  NA
## 984        <NA>  NA
## 985        <NA>  NA
## 986        <NA>  NA
## 987        <NA>  NA
## 988        <NA>  NA
## 989        <NA>  NA
## 990        <NA>  NA
## 991        <NA>  NA
## 992        <NA>  NA
## 993        <NA>  NA
## 994        <NA>  NA
## 995        <NA>  NA
## 996        <NA>  NA
## 997        <NA>  NA
## 998        <NA>  NA
## 999        <NA>  NA
## 1000       <NA>  NA
## 1001       <NA>  NA
## 1002       <NA>  NA
## 1003       <NA>  NA
## 1004       <NA>  NA
## 1005       <NA>  NA
## 1006       <NA>  NA
## 1007       <NA>  NA
## 1008       <NA>  NA
## 1009       <NA>  NA
## 1010       <NA>  NA
## 1011       <NA>  NA
## 1012       <NA>  NA
## 1013       <NA>  NA
## 1014       <NA>  NA
## 1015       <NA>  NA
## 1016       <NA>  NA
## 1017       <NA>  NA
## 1018       <NA>  NA
## 1019       <NA>  NA
## 1020       <NA>  NA
## 1021       <NA>  NA
## 1022       <NA>  NA
## 1023       <NA>  NA
## 1024       <NA>  NA
## 1025       <NA>  NA
## 1026       <NA>  NA
## 1027       <NA>  NA
## 1028       <NA>  NA
## 1029       <NA>  NA
## 1030       <NA>  NA
## 1031       <NA>  NA
## 1032       <NA>  NA
## 1033       <NA>  NA
## 1034       <NA>  NA
## 1035       <NA>  NA
## 1036       <NA>  NA
## 1037       <NA>  NA
## 1038       <NA>  NA
## 1039       <NA>  NA
## 1040       <NA>  NA
## 1041       <NA>  NA
## 1042       <NA>  NA
## 1043       <NA>  NA
## 1044       <NA>  NA
## 1045       <NA>  NA
## 1046       <NA>  NA
## 1047       <NA>  NA
## 1048       <NA>  NA
## 1049       <NA>  NA
## 1050       <NA>  NA
## 1051       <NA>  NA
## 1052       <NA>  NA
## 1053       <NA>  NA
## 1054       <NA>  NA
## 1055       <NA>  NA
## 1056       <NA>  NA
## 1057       <NA>  NA
## 1058       <NA>  NA
## 1059       <NA>  NA
## 1060       <NA>  NA
## 1061       <NA>  NA
## 1062       <NA>  NA
## 1063       <NA>  NA
## 1064       <NA>  NA
## 1065       <NA>  NA
## 1066       <NA>  NA
## 1067       <NA>  NA
## 1068       <NA>  NA
## 1069       <NA>  NA
## 1070       <NA>  NA
## 1071       <NA>  NA
## 1072       <NA>  NA
## 1073       <NA>  NA
## 1074       <NA>  NA
## 1075       <NA>  NA
## 1076       <NA>  NA
## 1077       <NA>  NA
## 1078       <NA>  NA
## 1079       <NA>  NA
## 1080       <NA>  NA
## 1081       <NA>  NA
## 1082       <NA>  NA
## 1083       <NA>  NA
## 1084       <NA>  NA
## 1085       <NA>  NA
## 1086       <NA>  NA
## 1087       <NA>  NA
## 1088       <NA>  NA
## 1089       <NA>  NA
## 1090       <NA>  NA
## 1091       <NA>  NA
## 1092       <NA>  NA
## 1093       <NA>  NA
## 1094       <NA>  NA
## 1095       <NA>  NA
## 1096       <NA>  NA
## 1097       <NA>  NA
## 1098       <NA>  NA
## 1099       <NA>  NA
## 1100       <NA>  NA
## 1101       <NA>  NA
## 1102       <NA>  NA
## 1103       <NA>  NA
## 1104       <NA>  NA
## 1105       <NA>  NA
## 1106       <NA>  NA
## 1107       <NA>  NA
## 1108       <NA>  NA
## 1109       <NA>  NA
## 1110       <NA>  NA
## 1111       <NA>  NA
## 1112       <NA>  NA
## 1113       <NA>  NA
## 1114       <NA>  NA
## 1115       <NA>  NA
## 1116       <NA>  NA
## 1117       <NA>  NA
## 1118       <NA>  NA
## 1119       <NA>  NA
## 1120       <NA>  NA
## 1121       <NA>  NA
## 1122       <NA>  NA
## 1123       <NA>  NA
## 1124       <NA>  NA
## 1125       <NA>  NA
## 1126       <NA>  NA
## 1127       <NA>  NA
## 1128       <NA>  NA
## 1129       <NA>  NA
## 1130       <NA>  NA
## 1131       <NA>  NA
## 1132       <NA>  NA
## 1133       <NA>  NA
## 1134       <NA>  NA
## 1135       <NA>  NA
## 1136       <NA>  NA
## 1137       <NA>  NA
## 1138       <NA>  NA
## 1139       <NA>  NA
## 1140       <NA>  NA
## 1141       <NA>  NA
## 1142       <NA>  NA
## 1143       <NA>  NA
## 1144       <NA>  NA
## 1145       <NA>  NA
## 1146       <NA>  NA
## 1147       <NA>  NA
## 1148       <NA>  NA
## 1149       <NA>  NA
## 1150       <NA>  NA
## 1151       <NA>  NA
## 1152       <NA>  NA
## 1153       <NA>  NA
## 1154       <NA>  NA
## 1155       <NA>  NA
## 1156       <NA>  NA
## 1157       <NA>  NA
## 1158       <NA>  NA
## 1159       <NA>  NA
## 1160       <NA>  NA
## 1161       <NA>  NA
## 1162       <NA>  NA
## 1163       <NA>  NA
## 1164       <NA>  NA
## 1165       <NA>  NA
## 1166       <NA>  NA
## 1167       <NA>  NA
## 1168       <NA>  NA
## 1169       <NA>  NA
## 1170       <NA>  NA
## 1171       <NA>  NA
## 1172       <NA>  NA
## 1173       <NA>  NA
## 1174       <NA>  NA
## 1175       <NA>  NA
## 1176       <NA>  NA
## 1177       <NA>  NA
## 1178       <NA>  NA
## 1179       <NA>  NA
## 1180       <NA>  NA
## 1181       <NA>  NA
## 1182       <NA>  NA
## 1183       <NA>  NA
## 1184       <NA>  NA
## 1185       <NA>  NA
## 1186       <NA>  NA
## 1187       <NA>  NA
## 1188       <NA>  NA
## 1189       <NA>  NA
## 1190       <NA>  NA
## 1191       <NA>  NA
## 1192       <NA>  NA
## 1193       <NA>  NA
## 1194       <NA>  NA
## 1195       <NA>  NA
## 1196       <NA>  NA
## 1197       <NA>  NA
## 1198       <NA>  NA
## 1199       <NA>  NA
## 1200       <NA>  NA
## 1201       <NA>  NA
## 1202       <NA>  NA
## 1203       <NA>  NA
## 1204       <NA>  NA
## 1205       <NA>  NA
## 1206       <NA>  NA
## 1207       <NA>  NA
## 1208       <NA>  NA
## 1209       <NA>  NA
## 1210       <NA>  NA
## 1211       <NA>  NA
## 1212       <NA>  NA
## 1213       <NA>  NA
## 1214       <NA>  NA
## 1215       <NA>  NA
## 1216       <NA>  NA
## 1217       <NA>  NA
## 1218       <NA>  NA
## 1219       <NA>  NA
## 1220       <NA>  NA
## 1221       <NA>  NA
## 1222       <NA>  NA
## 1223       <NA>  NA
## 1224       <NA>  NA
## 1225       <NA>  NA
## 1226       <NA>  NA
## 1227       <NA>  NA
## 1228       <NA>  NA
## 1229       <NA>  NA
## 1230       <NA>  NA
## 1231       <NA>  NA
## 1232       <NA>  NA
## 1233       <NA>  NA
## 1234       <NA>  NA
## 1235       <NA>  NA
## 1236       <NA>  NA
## 1237       <NA>  NA
## 1238       <NA>  NA
## 1239       <NA>  NA
## 1240       <NA>  NA
## 1241       <NA>  NA
## 1242       <NA>  NA
## 1243       <NA>  NA
## 1244       <NA>  NA
## 1245       <NA>  NA
## 1246       <NA>  NA
## 1247       <NA>  NA
## 1248       <NA>  NA
## 1249       <NA>  NA
## 1250       <NA>  NA
## 1251       <NA>  NA
## 1252       <NA>  NA
## 1253       <NA>  NA
## 1254       <NA>  NA
## 1255       <NA>  NA
## 1256       <NA>  NA
## 1257       <NA>  NA
## 1258       <NA>  NA
## 1259       <NA>  NA
## 1260       <NA>  NA
## 1261       <NA>  NA
## 1262       <NA>  NA
## 1263       <NA>  NA
## 1264       <NA>  NA
## 1265       <NA>  NA
## 1266       <NA>  NA
## 1267       <NA>  NA
## 1268       <NA>  NA
## 1269       <NA>  NA
## 1270       <NA>  NA
## 1271       <NA>  NA
## 1272       <NA>  NA
## 1273       <NA>  NA
## 1274       <NA>  NA
## 1275       <NA>  NA
## 1276       <NA>  NA
## 1277       <NA>  NA
## 1278       <NA>  NA
## 1279       <NA>  NA
## 1280       <NA>  NA
## 1281       <NA>  NA
## 1282       <NA>  NA
## 1283       <NA>  NA
## 1284       <NA>  NA
## 1285       <NA>  NA
## 1286       <NA>  NA
## 1287       <NA>  NA
## 1288       <NA>  NA
## 1289       <NA>  NA
## 1290       <NA>  NA
## 1291       <NA>  NA
## 1292       <NA>  NA
## 1293       <NA>  NA
## 1294       <NA>  NA
## 1295       <NA>  NA
## 1296       <NA>  NA
## 1297       <NA>  NA
## 1298       <NA>  NA
## 1299       <NA>  NA
## 1300       <NA>  NA
## 1301       <NA>  NA
## 1302       <NA>  NA
## 1303       <NA>  NA
## 1304       <NA>  NA
## 1305       <NA>  NA
## 1306       <NA>  NA
## 1307       <NA>  NA
## 1308       <NA>  NA
## 1309       <NA>  NA
## 1310       <NA>  NA
## 1311       <NA>  NA
## 1312       <NA>  NA
## 1313       <NA>  NA
## 1314       <NA>  NA
## 1315       <NA>  NA
## 1316       <NA>  NA
## 1317       <NA>  NA
## 1318       <NA>  NA
## 1319       <NA>  NA
## 1320       <NA>  NA
## 1321       <NA>  NA
## 1322       <NA>  NA
## 1323       <NA>  NA
## 1324       <NA>  NA
## 1325       <NA>  NA
## 1326       <NA>  NA
## 1327       <NA>  NA
## 1328       <NA>  NA
## 1329       <NA>  NA
## 1330       <NA>  NA
## 1331       <NA>  NA
## 1332       <NA>  NA
## 1333       <NA>  NA
## 1334       <NA>  NA
## 1335       <NA>  NA
## 1336       <NA>  NA
## 1337       <NA>  NA
## 1338       <NA>  NA
## 1339       <NA>  NA
## 1340       <NA>  NA
## 1341       <NA>  NA
## 1342       <NA>  NA
## 1343       <NA>  NA
## 1344       <NA>  NA
## 1345       <NA>  NA
## 1346       <NA>  NA
## 1347       <NA>  NA
## 1348       <NA>  NA
## 1349       <NA>  NA
## 1350       <NA>  NA
## 1351       <NA>  NA
## 1352       <NA>  NA
## 1353       <NA>  NA
## 1354       <NA>  NA
## 1355       <NA>  NA
## 1356       <NA>  NA
## 1357       <NA>  NA
## 1358       <NA>  NA
## 1359       <NA>  NA
## 1360       <NA>  NA
## 1361       <NA>  NA
## 1362       <NA>  NA
## 1363       <NA>  NA
## 1364       <NA>  NA
## 1365       <NA>  NA
## 1366       <NA>  NA
## 1367       <NA>  NA
## 1368       <NA>  NA
## 1369       <NA>  NA
## 1370       <NA>  NA
## 1371       <NA>  NA
## 1372       <NA>  NA
## 1373       <NA>  NA
## 1374       <NA>  NA
## 1375       <NA>  NA
## 1376       <NA>  NA
## 1377       <NA>  NA
## 1378       <NA>  NA
## 1379       <NA>  NA
## 1380       <NA>  NA
## 1381       <NA>  NA
## 1382       <NA>  NA
## 1383       <NA>  NA
## 1384       <NA>  NA
## 1385       <NA>  NA
## 1386       <NA>  NA
## 1387       <NA>  NA
## 1388       <NA>  NA
## 1389       <NA>  NA
## 1390       <NA>  NA
## 1391       <NA>  NA
## 1392       <NA>  NA
## 1393       <NA>  NA
## 1394       <NA>  NA
## 1395       <NA>  NA
## 1396       <NA>  NA
## 1397       <NA>  NA
## 1398       <NA>  NA
## 1399       <NA>  NA
## 1400       <NA>  NA
## 1401       <NA>  NA
## 1402       <NA>  NA
## 1403       <NA>  NA
## 1404       <NA>  NA
## 1405       <NA>  NA
## 1406       <NA>  NA
## 1407       <NA>  NA
## 1408       <NA>  NA
## 1409       <NA>  NA
## 1410       <NA>  NA
## 1411       <NA>  NA
## 1412       <NA>  NA
## 1413       <NA>  NA
## 1414       <NA>  NA
## 1415       <NA>  NA
## 1416       <NA>  NA
## 1417       <NA>  NA
## 1418       <NA>  NA
## 1419       <NA>  NA
## 1420       <NA>  NA
## 1421       <NA>  NA
## 1422       <NA>  NA
## 1423       <NA>  NA
## 1424       <NA>  NA
## 1425       <NA>  NA
## 1426       <NA>  NA
## 1427       <NA>  NA
## 1428       <NA>  NA
## 1429       <NA>  NA
## 1430       <NA>  NA
## 1431       <NA>  NA
## 1432       <NA>  NA
## 1433       <NA>  NA
## 1434       <NA>  NA
## 1435       <NA>  NA
## 1436       <NA>  NA
## 1437       <NA>  NA
## 1438       <NA>  NA
## 1439       <NA>  NA
## 1440       <NA>  NA
## 1441       <NA>  NA
## 1442       <NA>  NA
## 1443       <NA>  NA
## 1444       <NA>  NA
## 1445       <NA>  NA
## 1446       <NA>  NA
## 1447       <NA>  NA
## 1448       <NA>  NA
## 1449       <NA>  NA
## 1450       <NA>  NA
## 1451       <NA>  NA
## 1452       <NA>  NA
## 1453       <NA>  NA
## 1454       <NA>  NA
## 1455       <NA>  NA
## 1456       <NA>  NA
## 1457       <NA>  NA
## 1458       <NA>  NA
## 1459       <NA>  NA
## 1460       <NA>  NA
## 1461       <NA>  NA
## 1462       <NA>  NA
## 1463       <NA>  NA
## 1464       <NA>  NA
## 1465       <NA>  NA
## 1466       <NA>  NA
## 1467       <NA>  NA
## 1468       <NA>  NA
## 1469       <NA>  NA
## 1470       <NA>  NA
## 1471       <NA>  NA
## 1472       <NA>  NA
## 1473       <NA>  NA
## 1474       <NA>  NA
## 1475       <NA>  NA
## 1476       <NA>  NA
## 1477       <NA>  NA
## 1478       <NA>  NA
## 1479       <NA>  NA
## 1480       <NA>  NA
## 1481       <NA>  NA
## 1482       <NA>  NA
## 1483       <NA>  NA
## 1484       <NA>  NA
## 1485       <NA>  NA
## 1486       <NA>  NA
## 1487       <NA>  NA
## 1488       <NA>  NA
## 1489       <NA>  NA
## 1490       <NA>  NA
## 1491       <NA>  NA
## 1492       <NA>  NA
## 1493       <NA>  NA
## 1494       <NA>  NA
## 1495       <NA>  NA
## 1496       <NA>  NA
## 1497       <NA>  NA
## 1498       <NA>  NA
## 1499       <NA>  NA
## 1500       <NA>  NA
## 1501       <NA>  NA
## 1502       <NA>  NA
## 1503       <NA>  NA
## 1504       <NA>  NA
## 1505       <NA>  NA
## 1506       <NA>  NA
## 1507       <NA>   0
## 1508       <NA>  NA
## 1509       <NA>  NA
## 1510       <NA>  NA
## 1511       <NA>  NA
## 1512       <NA>  NA
## 1513       <NA>  NA
## 1514       <NA>  NA
## 1515       <NA>  NA
## 1516       <NA>  NA
## 1517       <NA>  NA
## 1518       <NA>  NA
## 1519       <NA>  NA
## 1520       <NA>  NA
## 1521       <NA>  NA
## 1522       <NA>  NA
## 1523       <NA>  NA
## 1524       <NA>  NA
## 1525       <NA>  NA
## 1526       <NA>  NA
## 1527       <NA>  NA
## 1528       <NA>  NA
## 1529       <NA>  NA
## 1530       <NA>  NA
## 1531       <NA>  NA
## 1532       <NA>  NA
## 1533       <NA>  NA
## 1534       <NA>  NA
## 1535       <NA>  NA
## 1536       <NA>  NA
## 1537       <NA>  NA
## 1538       <NA>  NA
## 1539       <NA>  NA
## 1540       <NA>  NA
## 1541       <NA>  NA
## 1542       <NA>  NA
## 1543       <NA>  NA
## 1544       <NA>  NA
## 1545       <NA>  NA
## 1546       <NA>  NA
## 1547       <NA>  NA
## 1548       <NA>  NA
## 1549       <NA>  NA
## 1550       <NA>  NA
## 1551       <NA>  NA
## 1552       <NA>  NA
## 1553       <NA>  NA
## 1554       <NA>  NA
## 1555       <NA>  NA
## 1556       <NA>  NA
## 1557       <NA>  NA
## 1558       <NA>  NA
## 1559       <NA>   0
## 1560       <NA>  NA
## 1561       <NA>  NA
## 1562       <NA>  NA
## 1563       <NA>  NA
## 1564       <NA>  NA
## 1565       <NA>  NA
## 1566       <NA>  NA
## 1567       <NA>  NA
## 1568       <NA>  NA
## 1569       <NA>  NA
## 1570       <NA>  NA
## 1571       <NA>   0
## 1572       <NA>   0
## 1573       <NA>   0
## 1574       <NA>   0
## 1575       <NA>   0
## 1576       <NA>   0
## 1577       <NA>   0
## 1578       <NA>  NA
## 1579       <NA>  NA
## 1580       <NA>   0
## 1581       <NA>  NA
## 1582       <NA>   0
## 1583       <NA>  NA
## 1584       <NA>  NA
## 1585       <NA>   0
## 1586       <NA>   0
## 1587       <NA>   0
## 1588       <NA>   0
## 1589       <NA>  NA
## 1590       <NA>  NA
## 1591       <NA>   0
## 1592       <NA>  NA
## 1593       <NA>  NA
## 1594       <NA>   0
## 1595       <NA>   0
## 1596       <NA>  NA
## 1597       <NA>  NA
## 1598       <NA>   0
## 1599       <NA>   0
## 1600       <NA>  NA
## 1601       <NA>   0
## 1602       <NA>  NA
## 1603       <NA>  NA
## 1604       <NA>  NA
## 1605       <NA>   0
## 1606       <NA>   0
## 1607       <NA>   0
## 1608       <NA>   0
## 1609       <NA>   0
## 1610       <NA>   0
## 1611       <NA>   0
## 1612       <NA>  NA
## 1613       <NA>   0
## 1614       <NA>   0
## 1615       <NA>   0
## 1616       <NA>   0
## 1617       <NA>  NA
## 1618       <NA>   0
## 1619       <NA>   0
## 1620       <NA>   0
## 1621       <NA>  NA
## 1622       <NA>  NA
## 1623       <NA>  NA
## 1624       <NA>   0
## 1625       <NA>   0
## 1626       <NA>   0
## 1627       <NA>   0
## 1628       <NA>   0
## 1629       <NA>  NA
## 1630       <NA>   0
## 1631       <NA>   0
## 1632       <NA>  NA
## 1633       <NA>   0
## 1634       <NA>   0
## 1635       <NA>   0
## 1636       <NA>   0
## 1637       <NA>  NA
## 1638       <NA>  NA
## 1639       <NA>  NA
## 1640       <NA>   0
## 1641       <NA>  NA
## 1642       <NA>  NA
## 1643       <NA>  NA
## 1644       <NA>  NA
## 1645       <NA>  NA
## 1646       <NA>  NA
## 1647       <NA>   0
## 1648       <NA>   0
## 1649       <NA>   0
## 1650       <NA>   0
## 1651       <NA>   0
## 1652       <NA>   0
## 1653       <NA>   0
## 1654       <NA>   0
## 1655       <NA>   0
## 1656       <NA>   0
## 1657       <NA>  NA
## 1658       <NA>   0
## 1659       <NA>   0
## 1660       <NA>  NA
## 1661       <NA>   0
## 1662       <NA>   0
## 1663       <NA>   0
## 1664       <NA>   0
## 1665       <NA>   0
## 1666       <NA>   0
## 1667       <NA>   0
## 1668       <NA>   0
## 1669       <NA>  NA
## 1670       <NA>   0
## 1671       <NA>   0
## 1672       <NA>   0
## 1673       <NA>   0
## 1674       <NA>  NA
## 1675       <NA>   0
## 1676       <NA>   0
## 1677       <NA>   0
## 1678       <NA>   0
## 1679       <NA>   0
## 1680       <NA>  NA
## 1681       <NA>   0
## 1682       <NA>   0
## 1683       <NA>   0
## 1684       <NA>   0
## 1685       <NA>   0
## 1686       <NA>   0
## 1687       <NA>   0
## 1688       <NA>   0
## 1689       <NA>   0
## 1690       <NA>   0
## 1691       <NA>   0
## 1692       <NA>   0
## 1693       <NA>   0
## 1694       <NA>   0
## 1695       <NA>   0
## 1696       <NA>   0
## 1697       <NA>   0
## 1698       <NA>   0
## 1699       <NA>   0
## 1700       <NA>   0
## 1701       <NA>   0
## 1702       <NA>   0
## 1703       <NA>   0
## 1704       <NA>  NA
## 1705       <NA>   0
## 1706       <NA>   0
## 1707       <NA>   0
## 1708       <NA>   0
## 1709       <NA>   0
## 1710       <NA>  NA
## 1711       <NA>   0
## 1712       <NA>   0
## 1713       <NA>   0
## 1714       <NA>  NA
## 1715       <NA>   0
## 1716       <NA>   0
## 1717       <NA>   0
## 1718       <NA>   0
## 1719       <NA>   0
## 1720       <NA>  NA
## 1721       <NA>   0
## 1722       <NA>   0
## 1723       <NA>   0
## 1724       <NA>   0
## 1725       <NA>   0
## 1726       <NA>   0
## 1727       <NA>   0
## 1728       <NA>   0
## 1729       <NA>  NA
## 1730       <NA>   0
## 1731       <NA>   0
## 1732       <NA>  NA
## 1733       <NA>   0
## 1734       <NA>   0
## 1735       <NA>   0
## 1736       <NA>   0
## 1737       <NA>   0
## 1738       <NA>   0
## 1739       <NA>   0
## 1740       <NA>   0
## 1741       <NA>  NA
## 1742       <NA>   0
## 1743       <NA>   0
## 1744       <NA>   0
## 1745       <NA>  NA
## 1746       <NA>   0
## 1747       <NA>   0
## 1748       <NA>  NA
## 1749       <NA>   0
## 1750       <NA>   0
## 1751       <NA>   0
## 1752       <NA>   0
## 1753       <NA>   0
## 1754       <NA>   0
## 1755       <NA>   0
## 1756       <NA>   0
## 1757       <NA>   0
## 1758       <NA>   0
## 1759       <NA>   0
## 1760       <NA>   0
## 1761       <NA>   0
## 1762       <NA>   0
## 1763       <NA>  NA
## 1764       <NA>   0
## 1765       <NA>   0
## 1766       <NA>   0
## 1767       <NA>   0
## 1768       <NA>   0
## 1769       <NA>   0
## 1770       <NA>  NA
## 1771       <NA>   0
## 1772       <NA>   0
## 1773       <NA>   0
## 1774       <NA>   0
## 1775       <NA>   0
## 1776       <NA>  NA
## 1777       <NA>   0
## 1778       <NA>   0
## 1779       <NA>   0
## 1780       <NA>  NA
## 1781       <NA>   0
## 1782       <NA>   0
## 1783       <NA>   0
## 1784       <NA>   0
## 1785       <NA>   0
## 1786       <NA>   0
## 1787       <NA>   0
## 1788       <NA>   0
## 1789       <NA>   0
## 1790       <NA>   0
## 1791       <NA>   0
## 1792       <NA>   0
## 1793       <NA>   0
## 1794       <NA>  NA
## 1795       <NA>   0
## 1796       <NA>   0
## 1797       <NA>   0
## 1798       <NA>   0
## 1799       <NA>   0
## 1800       <NA>  NA
## 1801       <NA>   0
## 1802       <NA>   0
## 1803       <NA>   0
## 1804       <NA>   0
## 1805       <NA>   0
## 1806       <NA>   0
## 1807       <NA>   0
## 1808       <NA>   0
## 1809       <NA>   0
## 1810       <NA>   0
## 1811       <NA>   0
## 1812       <NA>   0
## 1813       <NA>   0
## 1814       <NA>   0
## 1815       <NA>  NA
## 1816       <NA>   0
## 1817       <NA>   0
## 1818       <NA>   0
## 1819       <NA>   0
## 1820       <NA>   0
## 1821       <NA>   0
## 1822       <NA>   0
## 1823       <NA>   0
## 1824       <NA>   0
## 1825       <NA>  NA
## 1826       <NA>   0
## 1827       <NA>   0
## 1828       <NA>   0
## 1829       <NA>   0
## 1830       <NA>   0
## 1831       <NA>   0
## 1832       <NA>   0
## 1833       <NA>   0
## 1834       <NA>   0
## 1835       <NA>   0
## 1836       <NA>   0
## 1837       <NA>   0
## 1838       <NA>   0
## 1839       <NA>   0
## 1840       <NA>  NA
## 1841       <NA>  NA
## 1842       <NA>   0
## 1843       <NA>   0
## 1844       <NA>   0
## 1845       <NA>   0
## 1846       <NA>   0
## 1847       <NA>   0
## 1848       <NA>   0
## 1849       <NA>   0
## 1850       <NA>  NA
## 1851       <NA>   0
## 1852       <NA>   0
## 1853       <NA>   0
## 1854       <NA>   0
## 1855       <NA>   0
## 1856       <NA>  NA
## 1857       <NA>  NA
## 1858       <NA>  NA
## 1859       <NA>   0
## 1860       <NA>   0
## 1861       <NA>   0
## 1862       <NA>   0
## 1863       <NA>   0
## 1864       <NA>  NA
## 1865       <NA>   0
## 1866       <NA>   0
## 1867       <NA>   0
## 1868       <NA>   0
## 1869       <NA>   0
## 1870       <NA>   0
## 1871       <NA>   0
## 1872       <NA>  NA
## 1873       <NA>   0
## 1874       <NA>  NA
## 1875       <NA>  NA
## 1876       <NA>   0
## 1877       <NA>   0
## 1878       <NA>   0
## 1879       <NA>   0
## 1880       <NA>   0
## 1881       <NA>   0
## 1882       <NA>   0
## 1883       <NA>   0
## 1884       <NA>   0
## 1885       <NA>  NA
## 1886       <NA>   0
## 1887       <NA>   0
## 1888       <NA>   0
## 1889       <NA>   0
## 1890       <NA>   0
## 1891       <NA>   0
## 1892       <NA>   0
## 1893       <NA>  NA
## 1894       <NA>  NA
## 1895       <NA>  NA
## 1896       <NA>  NA
## 1897       <NA>  NA
## 1898       <NA>  NA
## 1899       <NA>  NA
## 1900       <NA>   0
## 1901       <NA>  NA
## 1902       <NA>  NA
## 1903       <NA>  NA
## 1904       <NA>  NA
## 1905       <NA>  NA
## 1906       <NA>  NA
## 1907       <NA>  NA
## 1908       <NA>  NA
## 1909       <NA>  NA
## 1910       <NA>  NA
## 1911       <NA>  NA
## 1912       <NA>  NA
## 1913       <NA>  NA
## 1914       <NA>  NA
## 1915       <NA>  NA
## 1916       <NA>  NA
## 1917       <NA>  NA
## 1918       <NA>  NA
## 1919       <NA>  NA
## 1920       <NA>  NA
## 1921       <NA>  NA
## 1922       <NA>  NA
## 1923       <NA>  NA
## 1924       <NA>  NA
## 1925       <NA>  NA
## 1926       <NA>  NA
## 1927       <NA>  NA
## 1928       <NA>  NA
## 1929       <NA>  NA
## 1930       <NA>  NA
## 1931       <NA>  NA
## 1932       <NA>  NA
## 1933       <NA>  NA
## 1934       <NA>  NA
## 1935       <NA>  NA
## 1936       <NA>  NA
## 1937       <NA>  NA
## 1938       <NA>  NA
## 1939       <NA>  NA
## 1940       <NA>  NA
## 1941       <NA>  NA
## 1942       <NA>  NA
## 1943       <NA>  NA
## 1944       <NA>  NA
## 1945       <NA>  NA
## 1946       <NA>  NA
## 1947       <NA>  NA
## 1948       <NA>  NA
## 1949       <NA>  NA
## 1950       <NA>  NA
## 1951       <NA>  NA
## 1952       <NA>  NA
## 1953       <NA>  NA
## 1954       <NA>  NA
## 1955       <NA>  NA
## 1956       <NA>  NA
## 1957       <NA>  NA
## 1958       <NA>  NA
## 1959       <NA>  NA
## 1960       <NA>  NA
## 1961       <NA>  NA
## 1962       <NA>  NA
## 1963       <NA>  NA
## 1964       <NA>  NA
## 1965       <NA>  NA
## 1966       <NA>  NA
## 1967       <NA>  NA
## 1968       <NA>  NA
## 1969       <NA>  NA
## 1970       <NA>  NA
## 1971       <NA>  NA
## 1972       <NA>  NA
## 1973       <NA>  NA
## 1974       <NA>  NA
## 1975       <NA>  NA
## 1976       <NA>  NA
## 1977       <NA>  NA
## 1978       <NA>  NA
## 1979       <NA>  NA
## 1980       <NA>  NA
## 1981       <NA>  NA
## 1982       <NA>  NA
## 1983       <NA>  NA
## 1984       <NA>  NA
## 1985       <NA>  NA
## 1986       <NA>  NA
## 1987       <NA>  NA
## 1988       <NA>  NA
## 1989       <NA>  NA
## 1990       <NA>  NA
## 1991       <NA>  NA
## 1992       <NA>  NA
## 1993       <NA>  NA
## 1994       <NA>  NA
## 1995       <NA>  NA
## 1996       <NA>  NA
## 1997       <NA>  NA
## 1998       <NA>  NA
## 1999       <NA>  NA
## 2000       <NA>  NA
## 2001       <NA>  NA
## 2002       <NA>  NA
## 2003       <NA>  NA
## 2004       <NA>  NA
## 2005       <NA>   0
## 2006       <NA>  NA
## 2007       <NA>  NA
## 2008       <NA>  NA
## 2009       <NA>  NA
## 2010       <NA>  NA
## 2011       <NA>  NA
## 2012       <NA>  NA
## 2013       <NA>  NA
## 2014       <NA>  NA
## 2015       <NA>   0
## 2016       <NA>  NA
## 2017       <NA>  NA
## 2018       <NA>  NA
## 2019       <NA>  NA
## 2020       <NA>   0
## 2021       <NA>   0
## 2022       <NA>   0
## 2023       <NA>  NA
## 2024       <NA>  NA
## 2025       <NA>   0
## 2026       <NA>   0
## 2027       <NA>  NA
## 2028       <NA>   0
## 2029       <NA>   0
## 2030       <NA>   0
## 2031       <NA>   0
## 2032       <NA>  NA
## 2033       <NA>  NA
## 2034       <NA>   0
## 2035       <NA>  NA
## 2036       <NA>  NA
## 2037       <NA>  NA
## 2038       <NA>  NA
## 2039       <NA>   0
## 2040       <NA>   0
## 2041       <NA>  NA
## 2042       <NA>  NA
## 2043       <NA>   0
## 2044       <NA>   0
## 2045       <NA>  NA
## 2046       <NA>  NA
## 2047       <NA>  NA
## 2048       <NA>  NA
## 2049       <NA>  NA
## 2050       <NA>   0
## 2051       <NA>   0
## 2052       <NA>   0
## 2053       <NA>  NA
## 2054       <NA>   0
## 2055       <NA>   0
## 2056       <NA>   0
## 2057       <NA>   0
## 2058       <NA>  NA
## 2059       <NA>  NA
## 2060       <NA>  NA
## 2061       <NA>   0
## 2062       <NA>  NA
## 2063       <NA>   0
## 2064       <NA>   0
## 2065       <NA>   0
## 2066       <NA>  NA
## 2067       <NA>   0
## 2068       <NA>   0
## 2069       <NA>  NA
## 2070       <NA>   0
## 2071       <NA>  NA
## 2072       <NA>  NA
## 2073       <NA>   0
## 2074       <NA>   0
## 2075       <NA>   0
## 2076       <NA>   0
## 2077       <NA>   0
## 2078       <NA>  NA
## 2079       <NA>   0
## 2080       <NA>  NA
## 2081       <NA>  NA
## 2082       <NA>   0
## 2083       <NA>   0
## 2084       <NA>   0
## 2085       <NA>   0
## 2086       <NA>   0
## 2087       <NA>   0
## 2088       <NA>   0
## 2089       <NA>  NA
## 2090       <NA>  NA
## 2091       <NA>  NA
## 2092       <NA>   0
## 2093       <NA>  NA
## 2094       <NA>   0
## 2095       <NA>   0
## 2096       <NA>   0
## 2097       <NA>   0
## 2098       <NA>  NA
## 2099       <NA>   0
## 2100       <NA>   0
## 2101       <NA>  NA
## 2102       <NA>   0
## 2103       <NA>   0
## 2104       <NA>  NA
## 2105       <NA>  NA
## 2106       <NA>  NA
## 2107       <NA>  NA
## 2108       <NA>   0
## 2109       <NA>   0
## 2110       <NA>   0
## 2111       <NA>   0
## 2112       <NA>   0
## 2113       <NA>  NA
## 2114       <NA>   0
## 2115       <NA>   0
## 2116       <NA>   0
## 2117       <NA>   0
## 2118       <NA>   0
## 2119       <NA>   0
## 2120       <NA>   0
## 2121       <NA>  NA
## 2122       <NA>  NA
## 2123       <NA>  NA
## 2124       <NA>  NA
## 2125       <NA>  NA
## 2126       <NA>  NA
## 2127       <NA>   0
## 2128       <NA>  NA
## 2129       <NA>   0
## 2130       <NA>  NA
## 2131       <NA>   0
## 2132       <NA>   0
## 2133       <NA>   0
## 2134       <NA>  NA
## 2135       <NA>  NA
## 2136       <NA>  NA
## 2137       <NA>   0
## 2138       <NA>   0
## 2139       <NA>  NA
## 2140       <NA>   0
## 2141       <NA>  NA
## 2142       <NA>  NA
## 2143       <NA>   0
## 2144       <NA>   0
## 2145       <NA>   0
## 2146       <NA>   0
## 2147       <NA>  NA
## 2148       <NA>  NA
## 2149       <NA>   0
## 2150       <NA>  NA
## 2151       <NA>  NA
## 2152       <NA>  NA
## 2153       <NA>  NA
## 2154       <NA>  NA
## 2155       <NA>   0
## 2156       <NA>  NA
## 2157       <NA>   0
## 2158       <NA>   0
## 2159       <NA>   0
## 2160       <NA>  NA
## 2161       <NA>  NA
## 2162       <NA>   0
## 2163       <NA>  NA
## 2164       <NA>  NA
## 2165       <NA>   0
## 2166       <NA>   0
## 2167       <NA>  NA
## 2168       <NA>  NA
## 2169       <NA>  NA
## 2170       <NA>   0
## 2171       <NA>  NA
## 2172       <NA>  NA
## 2173       <NA>   0
## 2174       <NA>   0
## 2175       <NA>   0
## 2176       <NA>  NA
## 2177       <NA>   0
## 2178       <NA>   0
## 2179       <NA>  NA
## 2180       <NA>  NA
## 2181       <NA>  NA
## 2182       <NA>  NA
## 2183       <NA>  NA
## 2184       <NA>   0
## 2185       <NA>   0
## 2186       <NA>   0
## 2187       <NA>   0
## 2188       <NA>  NA
## 2189       <NA>  NA
## 2190       <NA>  NA
## 2191       <NA>  NA
## 2192       <NA>  NA
## 2193       <NA>  NA
## 2194       <NA>  NA
## 2195       <NA>   0
## 2196       <NA>  NA
## 2197       <NA>   0
## 2198       <NA>   0
## 2199       <NA>  NA
## 2200       <NA>  NA
## 2201       <NA>  NA
## 2202       <NA>  NA
## 2203       <NA>  NA
## 2204       <NA>  NA
## 2205       <NA>   0
## 2206       <NA>   0
## 2207       <NA>   0
## 2208       <NA>  NA
## 2209       <NA>  NA
## 2210       <NA>  NA
## 2211       <NA>  NA
## 2212       <NA>  NA
## 2213       <NA>  NA
## 2214       <NA>   0
## 2215       <NA>  NA
## 2216       <NA>  NA
## 2217       <NA>  NA
## 2218       <NA>  NA
## 2219       <NA>   0
## 2220       <NA>   0
## 2221       <NA>  NA
## 2222       <NA>  NA
## 2223       <NA>  NA
## 2224       <NA>  NA
## 2225       <NA>   0
## 2226       <NA>   0
## 2227       <NA>  NA
## 2228       <NA>  NA
## 2229       <NA>   0
## 2230       <NA>   0
## 2231       <NA>  NA
## 2232       <NA>   0
## 2233       <NA>  NA
## 2234       <NA>  NA
## 2235       <NA>  NA
## 2236       <NA>  NA
## 2237       <NA>   0
## 2238       <NA>  NA
## 2239       <NA>  NA
## 2240       <NA>  NA
## 2241       <NA>  NA
## 2242       <NA>   0
## 2243       <NA>   0
## 2244       <NA>   0
## 2245       <NA>  NA
## 2246       <NA>   0
## 2247       <NA>   0
## 2248       <NA>  NA
## 2249       <NA>   0
## 2250       <NA>  NA
## 2251       <NA>  NA
## 2252       <NA>  NA
## 2253       <NA>  NA
## 2254       <NA>  NA
## 2255       <NA>   0
## 2256       <NA>   0
## 2257       <NA>  NA
## 2258       <NA>   0
## 2259       <NA>   0
## 2260       <NA>  NA
## 2261       <NA>  NA
## 2262       <NA>  NA
## 2263       <NA>   0
## 2264       <NA>  NA
## 2265       <NA>   0
## 2266       <NA>  NA
## 2267       <NA>   0
## 2268       <NA>   0
## 2269       <NA>  NA
## 2270       <NA>  NA
## 2271       <NA>   0
## 2272       <NA>   0
## 2273       <NA>   0
## 2274       <NA>  NA
## 2275       <NA>  NA
## 2276       <NA>  NA
## 2277       <NA>   0
## 2278       <NA>   0
## 2279       <NA>  NA
## 2280       <NA>  NA
## 2281       <NA>  NA
## 2282       <NA>   0
## 2283       <NA>   0
## 2284       <NA>  NA
## 2285       <NA>  NA
## 2286       <NA>   0
## 2287       <NA>   0
## 2288       <NA>  NA
## 2289       <NA>   0
## 2290       <NA>  NA
## 2291       <NA>  NA
## 2292       <NA>   0
## 2293       <NA>  NA
## 2294       <NA>  NA
## 2295       <NA>   0
## 2296       <NA>   0
## 2297       <NA>  NA
## 2298       <NA>  NA
## 2299       <NA>  NA
## 2300       <NA>  NA
## 2301       <NA>   0
## 2302       <NA>   0
## 2303       <NA>   0
## 2304       <NA>   0
## 2305       <NA>   0
## 2306       <NA>  NA
## 2307       <NA>   0
## 2308       <NA>   0
## 2309       <NA>   0
## 2310       <NA>   0
## 2311       <NA>   0
## 2312       <NA>  NA
## 2313       <NA>  NA
## 2314       <NA>  NA
## 2315       <NA>   0
## 2316       <NA>  NA
## 2317       <NA>  NA
## 2318       <NA>  NA
## 2319       <NA>   0
## 2320       <NA>   0
## 2321       <NA>  NA
## 2322       <NA>  NA
## 2323       <NA>  NA
## 2324       <NA>  NA
## 2325       <NA>   0
## 2326       <NA>   0
## 2327       <NA>  NA
## 2328       <NA>  NA
## 2329       <NA>   0
## 2330       <NA>  NA
## 2331       <NA>  NA
## 2332       <NA>   0
## 2333       <NA>   0
## 2334       <NA>  NA
## 2335       <NA>  NA
## 2336       <NA>   0
## 2337       <NA>   0
## 2338       <NA>   0
## 2339       <NA>  NA
## 2340       <NA>  NA
## 2341       <NA>   0
## 2342       <NA>   0
## 2343       <NA>   0
## 2344       <NA>  NA
## 2345       <NA>  NA
## 2346       <NA>   0
## 2347       <NA>   0
## 2348       <NA>  NA
## 2349       <NA>  NA
## 2350       <NA>  NA
## 2351       <NA>   0
## 2352       <NA>   0
## 2353       <NA>   0
## 2354       <NA>  NA
## 2355       <NA>   0
## 2356       <NA>   0
## 2357       <NA>   0
## 2358       <NA>   0
## 2359       <NA>   0
## 2360       <NA>  NA
## 2361       <NA>  NA
## 2362       <NA>   0
## 2363       <NA>  NA
## 2364       <NA>   0
## 2365       <NA>   0
## 2366       <NA>   0
## 2367       <NA>   0
## 2368       <NA>  NA
## 2369       <NA>  NA
## 2370       <NA>  NA
## 2371       <NA>  NA
## 2372       <NA>  NA
## 2373       <NA>  NA
## 2374       <NA>   0
## 2375       <NA>  NA
## 2376       <NA>  NA
## 2377       <NA>  NA
## 2378       <NA>  NA
## 2379       <NA>  NA
## 2380       <NA>  NA
## 2381       <NA>  NA
## 2382       <NA>  NA
## 2383       <NA>  NA
## 2384       <NA>  NA
## 2385       <NA>  NA
## 2386       <NA>  NA
## 2387       <NA>  NA
## 2388       <NA>  NA
## 2389       <NA>  NA
## 2390       <NA>  NA
## 2391       <NA>  NA
## 2392       <NA>  NA
## 2393       <NA>  NA
## 2394       <NA>  NA
## 2395       <NA>  NA
## 2396       <NA>  NA
## 2397       <NA>  NA
## 2398       <NA>  NA
## 2399       <NA>  NA
## 2400       <NA>  NA
## 2401       <NA>  NA
## 2402       <NA>  NA
## 2403       <NA>  NA
## 2404       <NA>  NA
## 2405       <NA>  NA
## 2406       <NA>  NA
## 2407       <NA>  NA
## 2408       <NA>  NA
## 2409       <NA>  NA
## 2410       <NA>  NA
## 2411       <NA>  NA
## 2412       <NA>   0
## 2413       <NA>  NA
## 2414       <NA>  NA
## 2415       <NA>   0
## 2416       <NA>  NA
## 2417       <NA>  NA
## 2418       <NA>  NA
## 2419       <NA>  NA
## 2420       <NA>  NA
## 2421       <NA>   0
## 2422       <NA>   0
## 2423       <NA>   0
## 2424       <NA>   0
## 2425       <NA>   0
## 2426       <NA>  NA
## 2427       <NA>  NA
## 2428       <NA>  NA
## 2429       <NA>   0
## 2430       <NA>   0
## 2431       <NA>   0
## 2432       <NA>   0
## 2433       <NA>   0
## 2434       <NA>   0
## 2435       <NA>   0
## 2436       <NA>   0
## 2437       <NA>   0
## 2438       <NA>  NA
## 2439       <NA>  NA
## 2440       <NA>  NA
## 2441       <NA>  NA
## 2442       <NA>  NA
## 2443       <NA>   0
## 2444       <NA>   0
## 2445       <NA>  NA
## 2446       <NA>   0
## 2447       <NA>  NA
## 2448       <NA>  NA
## 2449       <NA>  NA
## 2450       <NA>  NA
## 2451       <NA>  NA
## 2452       <NA>  NA
## 2453       <NA>   0
## 2454       <NA>  NA
## 2455       <NA>  NA
## 2456       <NA>   0
## 2457       <NA>  NA
## 2458       <NA>  NA
## 2459       <NA>  NA
## 2460       <NA>  NA
## 2461       <NA>  NA
## 2462       <NA>  NA
## 2463       <NA>   0
## 2464       <NA>   0
## 2465       <NA>   0
## 2466       <NA>   0
## 2467       <NA>   0
## 2468       <NA>  NA
## 2469       <NA>   0
## 2470       <NA>  NA
## 2471       <NA>  NA
## 2472       <NA>  NA
## 2473       <NA>  NA
## 2474       <NA>  NA
## 2475       <NA>  NA
## 2476       <NA>  NA
## 2477       <NA>  NA
## 2478       <NA>  NA
## 2479       <NA>  NA
## 2480       <NA>  NA
## 2481       <NA>  NA
## 2482       <NA>  NA
## 2483       <NA>  NA
## 2484       <NA>  NA
## 2485       <NA>  NA
## 2486       <NA>  NA
## 2487       <NA>   0
## 2488       <NA>  NA
## 2489       <NA>  NA
## 2490       <NA>  NA
## 2491       <NA>  NA
## 2492       <NA>   0
## 2493       <NA>  NA
## 2494       <NA>  NA
## 2495       <NA>  NA
## 2496       <NA>  NA
## 2497       <NA>   0
## 2498       <NA>  NA
## 2499       <NA>   0
## 2500       <NA>   0
## 2501       <NA>  NA
## 2502       <NA>   0
## 2503       <NA>  NA
## 2504       <NA>   0
## 2505       <NA>  NA
## 2506       <NA>  NA
## 2507       <NA>  NA
## 2508       <NA>   0
## 2509       <NA>  NA
## 2510       <NA>  NA
## 2511       <NA>   0
## 2512       <NA>   0
## 2513       <NA>   0
## 2514       <NA>   0
## 2515       <NA>  NA
## 2516       <NA>   0
## 2517       <NA>   0
## 2518       <NA>   0
## 2519       <NA>   0
## 2520       <NA>  NA
## 2521       <NA>  NA
## 2522       <NA>  NA
## 2523       <NA>  NA
## 2524       <NA>  NA
## 2525       <NA>  NA
## 2526       <NA>  NA
## 2527       <NA>   0
## 2528       <NA>  NA
## 2529       <NA>   0
## 2530       <NA>  NA
## 2531       <NA>  NA
## 2532       <NA>  NA
## 2533       <NA>  NA
## 2534       <NA>   0
## 2535       <NA>  NA
## 2536       <NA>  NA
## 2537       <NA>   0
## 2538       <NA>  NA
## 2539       <NA>   0
## 2540       <NA>  NA
## 2541       <NA>   0
## 2542       <NA>   0
## 2543       <NA>  NA
## 2544       <NA>  NA
## 2545       <NA>   0
## 2546       <NA>   0
## 2547       <NA>  NA
## 2548       <NA>   0
## 2549       <NA>  NA
## 2550       <NA>  NA
## 2551       <NA>  NA
## 2552       <NA>  NA
## 2553       <NA>   0
## 2554       <NA>   0
## 2555       <NA>  NA
## 2556       <NA>  NA
## 2557       <NA>   0
## 2558       <NA>   0
## 2559       <NA>  NA
## 2560       <NA>   0
## 2561       <NA>  NA
## 2562       <NA>   0
## 2563       <NA>  NA
## 2564       <NA>   0
## 2565       <NA>  NA
## 2566       <NA>  NA
## 2567       <NA>  NA
## 2568       <NA>  NA
## 2569       <NA>   0
## 2570       <NA>   0
## 2571       <NA>   0
## 2572       <NA>  NA
## 2573       <NA>   0
## 2574       <NA>   0
## 2575       <NA>  NA
## 2576       <NA>  NA
## 2577       <NA>  NA
## 2578       <NA>  NA
## 2579       <NA>  NA
## 2580       <NA>   0
## 2581       <NA>  NA
## 2582       <NA>  NA
## 2583       <NA>  NA
## 2584       <NA>   0
## 2585       <NA>  NA
## 2586       <NA>  NA
## 2587       <NA>   0
## 2588       <NA>   0
## 2589       <NA>   0
## 2590       <NA>   0
## 2591       <NA>  NA
## 2592       <NA>  NA
## 2593       <NA>  NA
## 2594       <NA>  NA
## 2595       <NA>   0
## 2596       <NA>   0
## 2597       <NA>  NA
## 2598       <NA>  NA
## 2599       <NA>   0
## 2600       <NA>  NA
## 2601       <NA>  NA
## 2602       <NA>  NA
## 2603       <NA>   0
## 2604       <NA>   0
## 2605       <NA>   0
## 2606       <NA>   0
## 2607       <NA>  NA
## 2608       <NA>  NA
## 2609       <NA>  NA
## 2610       <NA>  NA
## 2611       <NA>   0
## 2612       <NA>  NA
## 2613       <NA>  NA
## 2614       <NA>   0
## 2615       <NA>  NA
## 2616       <NA>   0
## 2617       <NA>   0
## 2618       <NA>  NA
## 2619       <NA>  NA
## 2620       <NA>  NA
## 2621       <NA>  NA
## 2622       <NA>  NA
## 2623       <NA>  NA
## 2624       <NA>  NA
summary(ssd$hospital_los, useNA = "ifany")
##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
## -6378.81     2.93     5.72     8.94    10.48 36530.32
ssd$hospitalLOS_Ranges <- cut(ssd$hospital_los, c(0, 1, 3, 5, 10, 20, 30, 60, 90, 150, 999))
table(ssd$hospitalLOS_Ranges,useNA = "ifany")
## 
##     (0,1]     (1,3]     (3,5]    (5,10]   (10,20]   (20,30]   (30,60] 
##    150460    582206    529927    820698    507248    143837     85601 
##   (60,90]  (90,150] (150,999]      <NA> 
##     12058      4741      2364      3381
summary(ssd$icu_los, useNA = "ifany")
##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
##  -5.3382   0.8278   1.6104   2.7858   3.0500 824.2104
ssd$icuLOS_Ranges <- cut(ssd$icu_los, c(0, 1, 3, 5, 10, 20, 30, 60, 999))
table(ssd$icuLOS_Ranges,useNA = "ifany")
## 
##    (0,1]    (1,3]    (3,5]   (5,10]  (10,20]  (20,30]  (30,60] (60,999] 
##   928888  1168923   352746   247099    99566    20292     8379      886 
##     <NA> 
##    15742
summary(ssd$ethnicity, useNA = "ifany")
##                  African American            Asian        Caucasian 
##            47920           304105            45050          2152704 
##         Hispanic  Native American    Other/Unknown 
##           145350            25711           121681
ssd <- ssd %>% mutate(ethnicity2=recode_factor(ethnicity,
                                                       `Caucasian` = "Caucasian",
                                                        `African American` = "African American",
                                                        `Hispanic`= "Hispanic",
                                                         `Asian` = "Asian",
                                                         `Native American` = "Native American",
                                                         `Other/Unknown` = "Other/Unknown",
                                                          .default = "Other/Unknown"))

summary(ssd$ethnicity2, useNA = "ifany")
##        Caucasian African American         Hispanic            Asian 
##          2152704           304105           145350            45050 
##  Native American    Other/Unknown 
##            25711           169601
summary(ssd$gender, useNA = "ifany")
##          Female    Male   Other Unknown 
##    4896 1309647 1527370      52     556
ssd <- ssd %>% mutate(gender2=recode_factor(gender,
                                                      `Male` = "Male",
                                                      `Female` = "Female", 
                                                      `Other`= "Other/Unknown", 
                                                      `Unknown` = "Other/Unknown",
                                                      .default = "Other/Unknown"))

summary(ssd$gender2, useNA = "ifany")
##          Male        Female Other/Unknown 
##       1527370       1309647          5504
ssd<- ssd%>%mutate(hospital_mortality=as.factor(hospital_mortality), hospital_mortality_ultimate=as.factor(hospital_mortality_ultimate), icu_mortality=as.factor(icu_mortality))

ssd <- ssd%>%mutate(hospital_region=as.factor(hospital_region))
summary(ssd$hospital_region)
##             Midwest Northeast     South      West 
##    632962    753120    165767    714254    576418
ssd <- ssd %>% mutate(hospital_region2=recode_factor(hospital_region, 'Midwest' = "Midwest", 'Northeast' = "Northeast", 'South' = "South", 'West' = "West", .default = "Unknown"))

summary(ssd$hospital_region2)
##   Midwest Northeast     South      West   Unknown 
##    753120    165767    714254    576418    632962

2 Sepsis Defined

We defined positive for sepsis (in-hospital sepsis) as having either a severe sepsis or septic shock diagnosis or having an infection and an acute organ failure diagnosis in the medical record during a 24-hour period starting from the documented ICU admission date and time. Patients with no diagnoses in the diagnoses

ssd<- ssd %>% mutate(sepsis_outcome = (sepsis >0 | (infection >0 & organfailure >0)))
summary(ssd$sepsis_outcome)
##    Mode   FALSE    TRUE    NA's 
## logical 1906183  485158  451180
table(ssd$sepsis_outcome, useNA = "ifany")
## 
##   FALSE    TRUE    <NA> 
## 1906183  485158  451180

3 Parsing of APACHE Admit Diagnoses

Parsing of APACHE admission diagnoses into organ system grouper with sepsis diagnoses in separate category. 25 diagnoses were categorized as Undefined with 16 transplant diagnoses and 9 of various other non-specific nature.

parse_dx <- function(x) {
  sp <- str_split(as.character(x),"\\|")
  idx <- sapply(sp,length)
  out <- sapply(1:length(idx),function(v) { return(sp[[v]][idx[v]])})
  return(out)
}

ap <- ap %>% mutate(new_apdx =parse_dx(admitdxpath)) %>% group_by(new_apdx) %>% mutate(n=row_number()) %>% ungroup()

nrow(ap)
## [1] 448
colnames(ap)
##  [1] "group"          "post.operative" "code"           "dx"            
##  [5] "number"         "admitdiagnosis" "admitdxpath"    "numobs"        
##  [9] "possible.group" "X"              "new_apdx"       "n"
ssd_j <- ssd %>% left_join(ap%>%filter(n==1)%>%select(-n),by=c("apacheadmissiondx"="new_apdx"))
## Warning: Column `apacheadmissiondx`/`new_apdx` joining factor and character
## vector, coercing into character vector
nrow(ssd_j)
## [1] 2842521
if(nrow(ssd_j)==nrow(ssd)) {ssd <- ssd_j;rm(ssd_j)}
nrow(ssd)
## [1] 2842521
summary(ssd$group, useNA = "ifany")
##             Cardiovascular           Gastrointestinal 
##                     839352                     266781 
##             Gynaecological              Hematological 
##                       6754                      18705 
##                  Metabolic Muscoskeletal/Skin disease 
##                     193873                      35740 
##               Neurological    Other medical disorders 
##                     323997                          0 
##        Renal/Genitourinary                Respiratory 
##                      61926                     381474 
##                     Sepsis                     Trauma 
##                     571651                     111731 
##                  Undefined                       NA's 
##                      21389                       9148
ssd<-ssd%>%mutate(group=droplevels(group))
summary(ssd$group, useNA = "ifany")
##             Cardiovascular           Gastrointestinal 
##                     839352                     266781 
##             Gynaecological              Hematological 
##                       6754                      18705 
##                  Metabolic Muscoskeletal/Skin disease 
##                     193873                      35740 
##               Neurological        Renal/Genitourinary 
##                     323997                      61926 
##                Respiratory                     Sepsis 
##                     381474                     571651 
##                     Trauma                  Undefined 
##                     111731                      21389 
##                       NA's 
##                       9148

4 Defining data variables: as.factor, as.character…

ssd <- ssd%>%mutate(dialysis=as.factor(dialysis),
                              aids=as.factor(aids),
                              hepaticfailure=as.factor(hepaticfailure|
                                                         cirrhosis),
                              diabetes=as.factor(diabetes),
                              immunosuppression=as.factor(immunosuppression),
                              leukemia=as.factor(leukemia),
                              lymphoma=as.factor(lymphoma),
                              metastaticcancer=as.factor(metastaticcancer),
                              thrombolytics=as.factor(thrombolytics),
                              cardiovascular_baseline=as.factor(cardiovascular_baseline))

ssd <- ssd%>%mutate(hospitaldischargeyear=as.character(hospitaldischargeyear))
ssd$hospitaldischargeyear[ssd$hospitaldischargeyear<=2010] <- "-2010"
ssd$hospitaldischargeyear[ssd$hospitaldischargeyear>=2015] <- "2015-16"
summary(ssd$hospitaldischargeyear)
##    Length     Class      Mode 
##   2842521 character character
ssd <- ssd%>%mutate(hospital_mortality=as.factor(hospital_mortality), hospital_mortality_ultimate=as.factor(hospital_mortality_ultimate), icu_mortality=as.factor(icu_mortality))

5 Medication Variable Decisions

Organ dysfunction criteria are met or ignored when certain medications are present. For example, when warfarin and heparin are present lab values associated with coagulopathies (INR and aPTT) are ignored. Vasopressors are generally ordered for a patient with evidence of hypotension, hypoperfusion, or shock. In this study, patients without activity in the medication tables were excluded. Medication data related to continuous infusions are found in one of two places; the medication table which indicates a medication as being ordered or in the nurse charted table indicating starting and/or titrating a continuous infusion. In the early years many ICUs used the TeleICU EHR (also known as eCareManager) as a clinical documentation system. Overtime as hospitals began to implement more comprehensive EHR solutions nurse charting was interfaced in many but not all ICUs. This is consistent with other studies using the eRI complete dataset.

ssd$dopamine_infusion[is.na(ssd$dopamine_infusion)]<-0
ssd$dopamine_medication[is.na(ssd$dopamine_medication)]<-0
ssd$epinephrine_infusion[is.na(ssd$epinephrine_infusion)]<-0
ssd$epinephrine_medication[is.na(ssd$epinephrine_medication)]<-0
ssd$norepinephrine_infusion[is.na(ssd$norepinephrine_infusion)]<-0
ssd$norepinephrine_medication[is.na(ssd$norepinephrine_medication)]<-0
ssd$milrinone_infusion[is.na(ssd$milrinone_infusion)]<-0
ssd$milrinone_medication[is.na(ssd$milrinone_medication)]<-0
ssd$phenylephrine_infusion[is.na(ssd$phenylephrine_infusion)]<-0
ssd$phenylephrine_medication[is.na(ssd$phenylephrine_medication)]<-0


nrow(ssd)
## [1] 2842521

6 Explanation of vital sign data variable decisions

Vital Sign (VS) data can come from several sources within the dataset. When multiple VS data sources were available within a single patient chart data were selected in this order 1) Charted/validated nurse 2) If no charted VS data were available then by vital signs interfaced from bedside monitor (unvalidated) were used 3) Non-invasive blood pressure (NIBP) data were selected over invasive blood pressure (IBP) data if both were present on the same patient. NIBP readings tend to have less variation than IBP readings. 4) APACHE VS variables are the worst reading from normal based on APACHE data collection methods.

ssd <- ssd %>% mutate(c_temp_min =ifelse (is.na (temperature_charted_min),ifelse(is.na(temperature_min), ifelse(temperature_apache==-1, NA, temperature_apache), temperature_min),temperature_charted_min))
summary(ssd$c_temp_min)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##     0.1    36.1    36.4    36.4    36.7   108.3  319848
ssd <- ssd %>% mutate(c_temp_max =if_else (is.na (temperature_charted_max),ifelse(is.na(temperature_max), ifelse(temperature_apache==-1, NA, temperature_apache), temperature_max),temperature_charted_max))
summary(ssd$c_temp_max)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##     0.1    36.8    37.1    37.3    37.6   112.6  319848
ssd <- ssd %>% mutate(c_HR_max =ifelse (is.na (heartrate_charted_max),ifelse(is.na(heartrate_max), ifelse(heartrate_apache==-1, NA, heartrate_apache), heartrate_max),heartrate_charted_max))
summary(ssd$c_HR_max)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##     1.0    86.0    99.0   101.4   115.0   387.0  112042
ssd <- ssd %>% mutate(c_resp_max =ifelse (is.na (respiratoryrate_charted_max),ifelse(is.na(respiratoryrate_max), ifelse(respiratoryrate_apache==-1, NA, respiratoryrate_apache), respiratoryrate_max),respiratoryrate_charted_max))
summary(ssd$c_resp_max)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##    1.00   21.00   25.00   26.98   30.00  200.00  134725
ssd <- ssd %>% mutate(c_sbp_min =ifelse (is.na (sbp_charted_min), ifelse(is.na(ibp_systolic_charted_min),nibp_systolic_charted_min, ibp_systolic_charted_min), sbp_charted_min))
summary(ssd$c_sbp_min)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##     1.0    85.0    98.0    99.1   113.0   264.0  702587
ssd <- ssd %>% mutate(c_sbp_min =ifelse(is.na(c_sbp_min),(sbp_min),c_sbp_min))
summary(ssd$c_sbp_min)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##    1.00   75.00   92.00   92.01  109.00  347.00  198922
ssd <- ssd %>% mutate(c_mbp_min =ifelse (is.na (nibp_mean_charted_min),ifelse(is.na(ibp_mean_charted_min), ifelse(mbp_apache==-1, NA, mbp_apache), ibp_mean_charted_min),nibp_mean_charted_min))
summary(ssd$c_mbp_min)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##    0.13   56.00   66.00   70.12   78.00  359.00  250116
ssd <- ssd %>% mutate(c_mbp_min=if_else(is.na(c_mbp_min),(mbp_charted_min),c_mbp_min))
summary(ssd$c_mbp_min)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##    0.13   56.00   66.00   70.12   78.00  359.00  250116
ssd %>% filter(is.na (nibp_systolic_charted_min))%>%select(c_sbp_min,ibp_systolic_charted_min)%>%head()
##   c_sbp_min ibp_systolic_charted_min
## 1        NA                       NA
## 2        NA                       NA
## 3        NA                       NA
## 4        NA                       NA
## 5        NA                       NA
## 6        NA                       NA
ssd %>% filter(is.na (nibp_mean_charted_min))%>%select(c_mbp_min,ibp_mean_charted_min)%>%head()
##   c_mbp_min ibp_mean_charted_min
## 1        NA                   NA
## 2        NA                   NA
## 3        NA                   NA
## 4        NA                   NA
## 5        NA                   NA
## 6        NA                   NA

7 ICU admit source recoded

Combined the 14 unique choices for source of admission into 6 like categories. NAs were coded as “Other”.

table(ssd$icu_admit_source, useNA = "ifany")
## 
##                          Acute Care/Floor    Chest Pain Center 
##                67402                27695                 9943 
##         Direct Admit Emergency Department       Emergency Room 
##               175631              1245659                  149 
##                Floor                  ICU           ICU to SDU 
##               407519                31038               188944 
##          Observation       Operating Room                Other 
##                  118               367328                   65 
##       Other Hospital            Other ICU                 PACU 
##                65765                85071                 8412 
##        Recovery Room Step-Down Unit (SDU) 
##               109083                52699
ssd <- ssd %>% mutate(icu_admit_source2=recode_factor(icu_admit_source,
                                                                `Acute Care/Floor`= "Floor",
                                                                `Chest Pain Center` = "OR/Proc Area",
                                                                `Direct Admit` = "Direct Admit",
                                                                `Emergency Department` = "Emergency Department",
                                                                `Floor` = "Floor",
                                                                `ICU` = "Other",
                                                                `ICU to SDU` = "Step-Down Unit",
                                                                `Observation` = "Other",
                                                                `Operating Room` = "OR/Proc Area",
                                                                `Other` = "Other",
                                                                `Other Hospital` = "Direct Admit",
                                                                `Other ICU` = "Other",
                                                                `PACU` = "OR/Proc Area",
                                                                `Recovery Room` = "OR/Proc Area",
                                                                `Step-Down Unit (SDU)`= "Step-Down Unit",
                                                                .default = "Other"))

table(ssd$icu_admit_source2,useNA = "ifany")
## 
##                Floor         OR/Proc Area         Direct Admit 
##               435214               494766               241396 
## Emergency Department                Other       Step-Down Unit 
##              1245659               183843               241643

8 ICU Type Decisions

It appears that the names of ICUs have changed over time within the dataset and the names selected by the vendor do not clearly distinguish the type of ICU. We decided to not use the ICU type in Table 1 or in the models for this reason.

ssd <- ssd %>% mutate(icu_type2=recode_factor(icu_type,
                                                                `Burn-Trauma ICU`= "Trauma ICU",
                                                                `Cardiac ICU`= "Cardiac Care ICU",
                                                                `CCU-CTICU` = "Cardiac/Surgical Care ICU",
                                                                `CCU` = "Cardiac Care ICU",
                                                                `CSICU` = "Cardiac/Surgical Care ICU",
                                                                `CTICU` = "Cardiac/Surgical Care ICU",
                                                                `Med-Surg ICU` = "Medical/Surgical ICU",
                                                                `MICU` = "Medical ICU",
                                                                `Mobile ICU` = "Other ICU",
                                                                `Neuro ICU` = "Neuro ICU",
                                                                `PACU` = "Other ICU",
                                                                `SICU` = "Surgical ICU",
                                                                `Trauma ICU` = "Trauma ICU",
                                                                `Vent ICU` = "Other ICU",
                                                                `VICU` = "Other ICU",
                                                                `Virtual ICU` = "Other ICU",
                                                                .default = "Other ICU"))
table(ssd$icu_type2, useNA = "ifany")
## 
##                Trauma ICU          Cardiac Care ICU 
##                     36823                    192048 
## Cardiac/Surgical Care ICU      Medical/Surgical ICU 
##                    437527                   1527054 
##               Medical ICU                 Other ICU 
##                    248339                     56590 
##                 Neuro ICU              Surgical ICU 
##                    164626                    179514
table(ssd$hospital_size, useNA = "ifany")
## 
##            <100 100-249 250-500    >500 
##  643295  141919  533513  481826 1041968

9 Discharge locations recoded

Combined the 18 unique discharge locations into 7 like categories. NAs were coded as “Other”.

ssd <- ssd %>% mutate(icu_disch_location2=recode_factor(icu_disch_location,
                                                                  `Acute Care/Floor`= "Floor",
                                                                  `Death` = "Death",
                                                                  `Floor` = "Floor",
                                                                  `Home` = "Home",
                                                                  `Nursing Home` = "SNF/Rehab",
                                                                  `ICU` = "Other",
                                                                  `Other ICU` = "Other",
                                                                  `Observation` = "Other",
                                                                  `Operating Room` = "Other",
                                                                  `Other` = "Other",
                                                                  `Other External` = "Other",
                                                                  `Other Internal` = "Floor",
                                                                  `Other Hospital` = "Other Hospital",
                                                                  `Other ICU (CABG)` = "Other",
                                                                  `Rehabilitation` = "SNF/Rehab",
                                                                  `Skilled Nursing Facility` = "SNF/Rehab",
                                                                  `Step-Down Unit (SDU)`= "Step-Down Unit",
                                                                  `Telemetry`= "Floor",
                                                                  .default = "Other"))


table(ssd$icu_disch_location2,useNA = "ifany")
## 
##          Floor          Death           Home      SNF/Rehab          Other 
##        1850937         154009         250587          34591         202328 
## Other Hospital Step-Down Unit 
##          58896         291173

10 Physician Specialties recoded

Combined the 48 unique physician specialties into 2 categories (Critical Care or Specialty-Other). Initial analyses in the subset suggested that there was a difference between Critical Care and all other categories. There were no NAs in the subset. There were 17 in the subset categorized as “unknown”; we coded these as “Specialty-Other”.

table(ssd$physicianspeciality,useNA = "ifany")
## 
##                                                    allergy/immunology 
##                            1010706                                590 
##                     anesthesiology                 anesthesiology/CCM 
##                               1463                               7519 
##                         cardiology       critical care medicine (CCM) 
##                             166439                             140776 
##                        dermatology                 emergency medicine 
##                                 35                               8121 
##                      endocrinology                             ethics 
##                               1536                                 13 
##                    family practice                   gastroenterology 
##                              85320                               6617 
##                         hematology                hematology/oncology 
##                                525                               3898 
##                        hospitalist                 infectious disease 
##                             259993                               2934 
##                  internal medicine                         nephrology 
##                             299354                              15389 
##                          neurology                              nurse 
##                              25726                                 73 
##                 nurse practitioner              obstetrics/gynecology 
##                                 59                               7244 
##                           oncology                      ophthalmology 
##                               7213                                200 
##                        orthopedics                              other 
##                               8931                              24891 
##                     otolaryngology                    pain management 
##                               5658                                 21 
##                         pharmacist            physical medicine/rehab 
##                                 11                                208 
##                         psychiatry                          pulmonary 
##                                378                              71676 
##                      pulmonary/CCM                          radiology 
##                             143113                               1964 
##              respiratory therapist                       rheumatology 
##                                 10                                 98 
##            Specialty Not Specified                    surgery-cardiac 
##                             142045                              73447 
##              surgery-critical care                    surgery-general 
##                               5883                             106574 
##                      surgery-neuro                       surgery-oral 
##                              52257                                253 
##                 surgery-orthopedic surgery-otolaryngology head & neck 
##                               2551                                267 
##                  surgery-pediatric                    surgery-plastic 
##                                 20                               1531 
##                 surgery-transplant                     surgery-trauma 
##                               2237                              29323 
##                   surgery-vascular                            unknown 
##                              31142                              80353 
##                            urology 
##                               5936
ssd <- ssd %>% mutate (physicianSpeciality2= droplevels(recode_factor(physicianspeciality,`critical care medicine (CCM)`= "Critical Care",`anesthesiology/CCM`= "Critical Care",`anesthesiology`= "Critical Care",`surgery-critical care` = "Critical Care",`surgery-trauma` = "Critical Care",`surgery-transplant` = "Speciality-Other",`surgery-orthopedic` = "Speciality-Other",`surgery-general` = "Speciality-Other",`surgery-oral` = "Speciality-Other",`surgery-pediatric` = "Speciality-Other",`surgery-otolaryngology head & neck` = "Speciality-Other", `surgery-cardiac` = "Critical Care",`neurology` = "Speciality-Other", `cardiology`= "Speciality-Other", `surgery-neuro` = "Speciality-Other",`surgery-plastic` = "Speciality-Other", `surgery-vascular` = "Speciality-Other", `oncology` = "Speciality-Other", `hematology` = "Speciality-Other", `hematology/oncology` = "Speciality-Other", `family practice` = "Speciality-Other", `internal medicine` = "Speciality-Other", `Specialty Not Specified` = "Speciality-Other",`urology` = "Speciality-Other",`orthopedics`= "Speciality-Other", `nephrology` = "Speciality-Other", `allergy/immunology` = "Speciality-Other",`dermatology` = "Speciality-Other",`endocrinology` = "Speciality-Other",`ethics` = "Speciality-Other",`emergency medicine` = "Speciality-Other",`gastroenterology` = "Speciality-Other",`obstetrics/gynecology` = "Speciality-Other", `nurse practitioner` = "Speciality-Other",`nurse` = "Speciality-Other",`ophthalmology` = "Speciality-Other",`respiratory therapist` = "Speciality-Other", `other` = "Speciality-Other", `specialty other` = "Speciality-Other", `radiology` = "Speciality-Other", `rheumatology` = "Speciality-Other", `rheumatology` = "Speciality-Other",`infectious disease` = "Speciality-Other",`otolaryngology` = "Speciality-Other",`physical medicine/rehab` = "Speciality-Other",`psychiatry` = "Speciality-Other",`unknown` = "Speciality-Other",`pulmonary` = "Critical Care", `pharmacist` = "Speciality-Other", `Medicine-General` = "Speciality-Other", `pain management` = "Speciality-Other", `pulmonary/CCM`= "Critical Care",`hospitalist` = "Speciality-Other", .default = "Speciality-Other")))
    
table(ssd$physicianSpeciality2,useNA = "ifany")                                                              
## 
##    Critical Care Speciality-Other 
##           473200          2369321

11 Explanation of Fuzzy Logic SIRS/OD, SIRS, SOFA, qSOFA

The sepsis Fuzzy Logic variables are broken up into Fuzzy Logic Systemic Inflammatory Response Syndrome (SIRs) and Fuzzy Logic organ dysfunction (OD). Baseline Sequential Organ Failure Assessment (SOFA) scores were assigned for three chronic health conditions using the same methodology as the ANZICS study: patients with chronic respiratory received 2 baseline points, and chronic hepatic and renal organ failure received 4 baseline points. For cardiovascular as a comorbid condition we used documented past medical history of myocardial infarction, congestive heart failure, and angina. The following comorbid conditions (also used for baseline SOFA scoring) were defined as: 1) for respiratory we used documented past medical history of COPD, respiratory failure, restrictive pulmonary disease, sarcoidosis, status post lung transplant, or abnormal pulmonary function tests; 2) for renal we used documented past medical history of dialysis; 3) for liver we used documented past medical history of hepatic failure or cirrhosis

SOFA organ dysfunction scoring was assigned per SOFA score definitions.

Note: We made a cut for SOFA Change but will need to review this in full dataset. See partition section.

ssd <- ssd %>% mutate (sofa_respiration_baseline2=as.factor(if_else(is.na(sofa_respiration_baseline),FALSE, as.logical(sofa_respiration_baseline))))

ssd <- ssd %>% mutate (sofa_renal_baseline2=as.factor(if_else(is.na(sofa_renal_baseline),FALSE, as.logical(sofa_renal_baseline))))

ssd <- ssd %>% mutate (sofa_liver_baseline2=as.factor(if_else(is.na(sofa_liver_baseline),FALSE, as.logical(sofa_liver_baseline))))

ssd <- ssd %>% mutate(SOFA_Change = (sofa_respiration*(sofa_respiration_baseline!=2) + sofa_coagulation + sofa_liver*(sofa_liver_baseline !=4) + sofa_cardiovascular + sofa_cns + sofa_renal*(sofa_renal_baseline!=4)))

ssd <- ssd %>% mutate(SOFA_Positive = SOFA_Change >=2)

summary(ssd$SOFA_Positive)
##    Mode   FALSE    TRUE 
## logical 1141836 1700685
table(ssd$SOFA_Positive,useNA = "ifany")
## 
##   FALSE    TRUE 
## 1141836 1700685
ssd <- ssd %>% mutate(SOFA_Score = (sofa_respiration + sofa_coagulation + sofa_liver + sofa_cardiovascular + sofa_cns + sofa_renal))

ssd <- ssd %>% mutate(SOFA_Positive2 = SOFA_Score >=2)
summary(ssd$SOFA_Positive2)
##    Mode   FALSE    TRUE 
## logical 1092979 1749542
table(ssd$SOFA_Positive2,useNA = "ifany")
## 
##   FALSE    TRUE 
## 1092979 1749542
ssd <- ssd %>% mutate(GCS_qSOFA = (gcs !=-3& (gcs<15)), 
                                BP_qSOFA = (c_sbp_min <=100),
                                Resp_qSOFA = (c_resp_max >=22))

ssd <- ssd %>% mutate(qSOFA_total = (if_else(is.na(GCS_qSOFA),FALSE,GCS_qSOFA) + if_else(is.na(BP_qSOFA),FALSE, BP_qSOFA) + if_else(is.na(Resp_qSOFA),FALSE,Resp_qSOFA)))
                                
ssd <- ssd %>% mutate(qSOFA_Positive = qSOFA_total >=2)

summary(ssd$qSOFA_Positive)
##    Mode   FALSE    TRUE 
## logical 1236207 1606314
table(ssd$qSOFA_Positive,useNA = "ifany")
## 
##   FALSE    TRUE 
## 1236207 1606314
ssd <- ssd %>% mutate(temp_SIRS = c_temp_max >38 | c_temp_min<36, 
                                wbc_SIRS = if_else(is.na(wbc_min) & is.na(wbc_max),bands_max>=10,if_else(is.na(bands_max),wbc_max>12 | wbc_min<4,if_else(!is.na(wbc_min)&!is.na(wbc_max)&!is.na(bands_max),wbc_max>12 | wbc_min<4 | bands_max>=10,NA))), 
                                resp_SIRS = if_else(is.na(c_resp_max), paco2_min <32, if_else(is.na(paco2_min), c_resp_max>20, if_else(!is.na(c_resp_max)&!is.na(paco2_min), c_resp_max>20 | paco2_min<32, NA))),
                                HR_SIRS = c_HR_max >90)
                                

ssd <- ssd %>% mutate(SIRS_total = (if_else(is.na(temp_SIRS),FALSE, temp_SIRS) + if_else(is.na(wbc_SIRS),FALSE, wbc_SIRS) + if_else(is.na(resp_SIRS),FALSE,resp_SIRS) + if_else(is.na(HR_SIRS), FALSE, HR_SIRS)))

table(ssd$SIRS_total,useNA = "ifany")
## 
##      0      1      2      3      4 
## 310612 593666 954052 724089 260102
ssd <- ssd %>% mutate(SIRS_Positive = SIRS_total >=2)

table(ssd$SIRS_Positive,useNA = "ifany")
## 
##   FALSE    TRUE 
##  904278 1938243
ssd <- ssd %>% mutate(StickyMinutes = if_else (soi_minutes >= od_minutes, soi_minutes, od_minutes))

ssd <- ssd %>% mutate(FuzzyTotal1 = (if_else(is.na(soi_alpha), 0, 1) + if_else(is.na(od_alpha), 0,1)))


### HERE

table(ssd$FuzzyTotal1,useNA = "ifany")
## 
##       0       1       2 
##  487388  932434 1422699
summary(ssd$FuzzyTotal1, useNA = "ifany")
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.000   1.000   2.000   1.329   2.000   2.000
#ssd %>% filter(patientunitstayid == 141289)

nrow(ssd)
## [1] 2842521
ssd <- ssd %>% mutate(SimultaneousMinutes = !is.na (both_minutes))

summary(ssd$SimultaneousMinutes)
##    Mode   FALSE    TRUE 
## logical 1523008 1319513
ssd <- ssd %>% mutate(SepsisFuzzyLogicPositive= !is.na (both_soi_alpha + both_od_alpha))

table(ssd$SepsisFuzzyLogicPositive,useNA = "ifany")
## 
##   FALSE    TRUE 
## 1523008 1319513
ssd <- ssd%>% mutate(SepsisFuzzyLogicPositive2 = SimultaneousMinutes)

12 Inclusion/Exclusion Criteria

The designs and findings from several previous studies using the complete dataset were used identify inclusion and exclusion criteria that would best support decision-making related to missingness and generalizability. To reduce introduction of missingness, patients where no evidence of interfaces or documentation for laboratory, vital sign, medication, and diagnosis related data existed, were excluded (convenience sample). Other similar large data studies made decisions related to imputation to deal with missingness. Limitations of imputation techniques include underestimation of standard errors/overestimation of test statistics, different imputation methods can produce different estimates and some methods can produce different estimates every time they are used on the same dataset, some require specialized software, and some can only be used for linear and log-linear models. Improper handling of missing data can compromise the validity of a study’s results or inferences. Because of the sheer number of cases within the complete dataset, as well as the subset, the researcher was not concerned about losing power. Secondly, patients that show no activity in laboratory, vital sign, medication, and diagnosis tables are not missing data at random but are likely missing because of a lack of interface between hospital information systems and the eCareManager system. Imputing on these cases may introduce the bias that is trying to be avoided Given these reasons a decision was made in advance to exclude cases with no activity in the tables forementioned. Table 1 “Exclusion versus Inclusion Demographic, Severity of Illness, Diagnostic and Sepsis Outcome Date” compares excluded versus included patients.

table(ssd$exclusion_yearfilter)
## 
##       0       1 
## 2020489  822032
table(ssd$exclusion_over18)
## 
##       0       1 
## 2830319   12202
table(!is.na(ssd$age))
## 
##   FALSE    TRUE 
##    2061 2840460
table(ssd$exclusion_firstadmission)
## 
##       0       1 
## 2369682  472839
table(ssd$exclusion_apacheiva)
## 
##       0       1 
## 1768014 1074507
table(ssd$exclusion_vitalobservations)
## 
##       0       1 
## 2550796  291725
table(ssd$exclusion_labobservations)
## 
##       0       1 
## 2767549   74972
table(ssd$exclusion_medobservations)
## 
##       0       1 
## 2413821  428700
ssd_incl <- ssd %>% filter(exclusion_yearfilter==0)
nrow(ssd_incl)
## [1] 2020489
ssd_incl <- ssd_incl %>% filter(exclusion_over18==0 & !is.na(age))
nrow(ssd_incl)
## [1] 2011652
ssd_incl <- ssd_incl %>% filter(exclusion_firstadmission==0)
nrow(ssd_incl)
## [1] 1666917
ssd_incl <-ssd_incl %>%filter(exclusion_apacheiva==0)
nrow(ssd_incl)
## [1] 1162680
ssd_incl <- ssd_incl %>% filter(exclusion_vitalobservations==0) 
nrow(ssd_incl)
## [1] 1073088
ssd_incl <- ssd_incl %>% filter(exclusion_labobservations==0)
nrow(ssd_incl)
## [1] 1068937
ssd_incl <- ssd_incl %>% filter(exclusion_medobservations==0)
nrow(ssd_incl)
## [1] 929538

Cases with no activity in the diagnosis table were excluded. Using a binary classification process positive for sepsis (in-hospital sepsis) was defined by having either a severe sepsis or septic shock diagnosis or having an infection and an acute organ failure diagnosis in the medical record during a 24-hour period starting from ICU admission date and time.

ssd_incl$hasDiagnosisCodes <- (!is.na(ssd_incl$sepsis)& !is.na(ssd_incl$organfailure)& !is.na(ssd_incl$infection))

ssd_incl <- ssd_incl %>% filter(hasDiagnosisCodes)

nrow(ssd_incl)
## [1] 912509

13 Preparation of data variables for Table 1

“Exclusion versus Inclusion Demographic, Severity of Illness, Diagnostic and Sepsis Outcome Date” compares excluded versus included patients.

ssd$hasDiagnosisCodes <- (!is.na(ssd$sepsis)& !is.na(ssd$organfailure)& !is.na(ssd$infection))
table(ssd$hasDiagnosisCodes, useNA = "ifany")
## 
##   FALSE    TRUE 
##  451180 2391341
ssd$inclusiongroup <- 1
ssd$inclusiongroup [ssd$exclusion_over18==1]<- 0 
ssd$inclusiongroup [ssd$exclusion_firstadmission==1]<- 0 
ssd$inclusiongroup [ssd$exclusion_apacheiva==1]<- 0 
ssd$inclusiongroup [ssd$exclusion_yearfilter==1]<- 0 
ssd$inclusiongroup [ssd$exclusion_vitalobservations==1]<- 0 
ssd$inclusiongroup [ssd$exclusion_labobservations==1]<- 0 
ssd$inclusiongroup [ssd$exclusion_medobservations==1]<- 0 
ssd$inclusiongroup [!ssd$hasDiagnosisCodes]<- 0 
summary(ssd$inclusiongroup, UseNA = "ifany")
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.000   0.000   0.000   0.321   1.000   1.000
table(ssd$inclusiongroup, useNA = "ifany")
## 
##       0       1 
## 1930007  912514
ssd %>%group_by(hospitalid)%>%summarise(n=n(), numberincluded=sum(inclusiongroup), numberexcluded=sum(inclusiongroup==0), proportionincluded=numberincluded/n)%>%filter(n>100)%>%ggplot(aes(proportionincluded))+geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

ssd %>%group_by(hospitalid)%>%summarise(n=n(), numberincluded=sum(inclusiongroup), numberexcluded=sum(inclusiongroup==0), proportionincluded=numberincluded/n)%>%filter(n>100 & proportionincluded<.05)
## # A tibble: 130 x 5
##    hospitalid     n numberincluded numberexcluded proportionincluded
##         <int> <int>          <dbl>          <int>              <dbl>
##  1          1  6840             0.           6840                 0.
##  2          3  1702             0.           1702                 0.
##  3          4  9705             0.           9705                 0.
##  4          5   722             0.            722                 0.
##  5          6  1768             0.           1768                 0.
##  6          7  1164             0.           1164                 0.
##  7          8  5523             0.           5523                 0.
##  8          9  6087             0.           6087                 0.
##  9         12  3538             0.           3538                 0.
## 10         13   566             0.            566                 0.
## # ... with 120 more rows
ssd %>%filter(hospitalid==207)%>%select(contains("exclusion_"),icu_type)%>%summary
##  exclusion_over18 exclusion_firstadmission exclusion_yearfilter
##  Min.   :0        Min.   :0.0000           Min.   :0.00000     
##  1st Qu.:0        1st Qu.:0.0000           1st Qu.:0.00000     
##  Median :0        Median :0.0000           Median :0.00000     
##  Mean   :0        Mean   :0.3363           Mean   :0.07171     
##  3rd Qu.:0        3rd Qu.:1.0000           3rd Qu.:0.00000     
##  Max.   :0        Max.   :1.0000           Max.   :1.00000     
##                                                                
##  exclusion_apacheiva exclusion_vitalobservations exclusion_labobservations
##  Min.   :0.0000      Min.   :0.00000             Min.   :0.00000          
##  1st Qu.:0.0000      1st Qu.:0.00000             1st Qu.:0.00000          
##  Median :1.0000      Median :0.00000             Median :0.00000          
##  Mean   :0.6921      Mean   :0.04839             Mean   :0.03725          
##  3rd Qu.:1.0000      3rd Qu.:0.00000             3rd Qu.:0.00000          
##  Max.   :1.0000      Max.   :1.00000             Max.   :1.00000          
##                                                                           
##  exclusion_medobservations               icu_type   
##  Min.   :0.0000            Med-Surg ICU      :5712  
##  1st Qu.:1.0000            Mobile ICU        :  33  
##  Median :1.0000            Burn-Trauma ICU   :   0  
##  Mean   :0.8019            Cardiac ICU       :   0  
##  3rd Qu.:1.0000            Cardiovascular ICU:   0  
##  Max.   :1.0000            CCU-CTICU         :   0  
##                            (Other)           :   0
ssd %>%filter(hospitalid==207)%>%select(contains("exclusion_"),icu_type, hasDiagnosisCodes)%>%summary
##  exclusion_over18 exclusion_firstadmission exclusion_yearfilter
##  Min.   :0        Min.   :0.0000           Min.   :0.00000     
##  1st Qu.:0        1st Qu.:0.0000           1st Qu.:0.00000     
##  Median :0        Median :0.0000           Median :0.00000     
##  Mean   :0        Mean   :0.3363           Mean   :0.07171     
##  3rd Qu.:0        3rd Qu.:1.0000           3rd Qu.:0.00000     
##  Max.   :0        Max.   :1.0000           Max.   :1.00000     
##                                                                
##  exclusion_apacheiva exclusion_vitalobservations exclusion_labobservations
##  Min.   :0.0000      Min.   :0.00000             Min.   :0.00000          
##  1st Qu.:0.0000      1st Qu.:0.00000             1st Qu.:0.00000          
##  Median :1.0000      Median :0.00000             Median :0.00000          
##  Mean   :0.6921      Mean   :0.04839             Mean   :0.03725          
##  3rd Qu.:1.0000      3rd Qu.:0.00000             3rd Qu.:0.00000          
##  Max.   :1.0000      Max.   :1.00000             Max.   :1.00000          
##                                                                           
##  exclusion_medobservations               icu_type    hasDiagnosisCodes
##  Min.   :0.0000            Med-Surg ICU      :5712   Mode :logical    
##  1st Qu.:1.0000            Mobile ICU        :  33   FALSE:3625       
##  Median :1.0000            Burn-Trauma ICU   :   0   TRUE :2120       
##  Mean   :0.8019            Cardiac ICU       :   0                    
##  3rd Qu.:1.0000            Cardiovascular ICU:   0                    
##  Max.   :1.0000            CCU-CTICU         :   0                    
##                            (Other)           :   0
summary(ssd$c_sbp_min, useNA = "ifany")
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##    1.00   75.00   92.00   92.01  109.00  347.00  198922
summary(ssd_incl$c_sbp_min, useNA = "ifany")
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##    1.00   78.00   92.00   92.14  107.00  256.00     184
summary(ssd$c_mbp_min, useNA = "ifany")
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##    0.13   56.00   66.00   70.12   78.00  359.00  250116
summary(ssd_incl$c_mbp_min, useNA = "ifany")
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    0.13   54.00   64.00   66.76   75.00  287.00
summary(ssd$c_temp_max, useNA = "ifany")
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##     0.1    36.8    37.1    37.3    37.6   112.6  319848
summary(ssd_incl$c_temp_max, useNA = "ifany")
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##    0.10   36.90   37.17   37.32   37.60  111.20   17387
summary(ssd$c_temp_min, useNA = "ifany")
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##     0.1    36.1    36.4    36.4    36.7   108.3  319848
summary(ssd_incl$c_temp_min, useNA = "ifany")
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##    0.10   36.10   36.40   36.29   36.70  101.00   17387
summary(ssd$c_resp_max, useNA = "ifany")
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##    1.00   21.00   25.00   26.98   30.00  200.00  134725
summary(ssd_incl$c_resp_max, useNA = "ifany")
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    1.00   22.00   26.00   28.01   31.00  199.00
summary(ssd$c_HR_max, useNA = "ifany")
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##     1.0    86.0    99.0   101.4   115.0   387.0  112042
summary(ssd_incl$c_HR_max, useNA = "ifany")
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     5.0    87.0   101.0   102.9   116.0   379.0

14 Table 1 Exclusion versus Inclusion

Demographic, Severity of Illness, Diagnostic, and Mortality Outcome Data

varsTable1compare <- c("age", "gender2", "ethnicity2", "BMI_Ranges", "icu_admit_source2","physicianSpeciality2", "hospitaldischargeyear", "hospital_teaching_status", "hospital_size", "hospital_region2","dialysis", "aids", "hepaticfailure", "diabetes", "immunosuppression", "leukemia", "lymphoma", "metastaticcancer", "thrombolytics", "sofa_respiration_baseline2", "cardiovascular_baseline","SIRS_Positive", "qSOFA_Positive", "SOFA_Positive", "SepsisFuzzyLogicPositive","apacheiva", "hospital_mortality_ultimate", "icu_mortality", "hospital_los", "icu_los", "sepsis_outcome", "group")


library(tableone); library(survival); library(dplyr); library(Hmisc); library(ggplot2); library(sjPlot)

if(!("tableone" %in% rownames(installed.packages()))) {
  install.packages("tableone")
}

Table1IncludeExclude <- CreateTableOne(data=ssd ,vars=varsTable1compare,strata="inclusiongroup",test=TRUE, includeNA=TRUE
) %>% print(nonnormal= c("icu_mortality","hospital_mortality_ultimate", "sepsis_outcome", "hospital_teaching_status"),minMax=TRUE,
  printToggle      = FALSE,
  showAllLevels    = TRUE,
  cramVars         = "kon"
) %>%
{data.frame(
  variable_name             = gsub(" ", "&nbsp;", rownames(.), fixed = TRUE), .,                                                                                                                     
  row.names        = NULL,
  check.names      = FALSE,
  stringsAsFactors = FALSE)} %>%
  knitr::kable(caption="Exclusion versus Inclusion Demographic, Severity of Illness, Diagnostic, and Outcome Data")

15 Checking hospital and regional level inclusion/exclusion

Review changes to hospital IDs due to inclusion/exclusion criteria. Hospital ID is the unique name of a hospital within the dataset. This analysis will review how many hospitals are dropped form the analyses. Hospitals that did not build interfaces between hospital information systems and the eCareManager system will be at highest risk of having patients excluded from this study. Review of regional data (included in Demographic, Severity of Illness, Diagnostic Tables) will allow readers to visualize if populations within certain region are under-represented.

ssd %>% mutate(inStudy = exclusion_yearfilter==0 & exclusion_over18==0 & exclusion_firstadmission==0 & exclusion_apacheiva==0 & exclusion_vitalobservations==0 & exclusion_labobservations==0 & exclusion_medobservations==0) %>% group_by(hospitalid) %>% summarise(n=n(),n_study=sum(inStudy),propInstudy=n_study/n)
## # A tibble: 334 x 4
##    hospitalid     n n_study propInstudy
##         <int> <int>   <int>       <dbl>
##  1          1  6840       0          0.
##  2          3  1702       0          0.
##  3          4  9705       0          0.
##  4          5   722       0          0.
##  5          6  1768       0          0.
##  6          7  1164       0          0.
##  7          8  5523       0          0.
##  8          9  6087       0          0.
##  9         12  3538       0          0.
## 10         13   566       0          0.
## # ... with 324 more rows
ssd %>% mutate(inStudy = exclusion_yearfilter==0 & exclusion_over18==0 & exclusion_firstadmission==0 & exclusion_apacheiva==0 & exclusion_vitalobservations==0 & exclusion_labobservations==0 & exclusion_medobservations==0) %>% group_by(hospitalid) %>% summarise(n=n(),n_study=sum(inStudy),propInstudy=n_study/n) %>% ggplot(aes(propInstudy)) + geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

boxplot(ssd$hospitalid,ssd_incl$hospitalid,las=2,main= "Hospital IDs Before/After Inclusion/Exclusion", names = c("Before", "After"))

ssd$albumin_apache[ssd$albumin_apache==(-1)] <- NA
ssd_incl$albumin_apache[ssd_incl$albumin_apache==(-1)] <- NA

16 Descriptive

Describing variables before and after inclusion/exclusion

describe(ssd)
## Warning in w * sort(x - mean(x)): longer object length is not a multiple of
## shorter object length
## ssd 
## 
##  296  Variables      2842521  Observations
## ---------------------------------------------------------------------------
## patientunitstayid 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2842521        0  2842521        1  1647239  1169471   142267   288023 
##      .25      .50      .75      .90      .95 
##   761960  1597616  2628874  3063221  3211145 
## 
## lowest :       1       2       3       4       5
## highest: 3353267 3353268 3353269 3353270 3353271
## ---------------------------------------------------------------------------
## exclusion_over18 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2842521        0        2    0.013    12202 0.004293 0.008548 
## 
## ---------------------------------------------------------------------------
## exclusion_firstadmission 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2842521        0        2    0.416   472839   0.1663   0.2773 
## 
## ---------------------------------------------------------------------------
## exclusion_yearfilter 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2842521        0        2    0.617   822032   0.2892   0.4111 
## 
## ---------------------------------------------------------------------------
## exclusion_apacheiva 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2842521        0        2    0.705  1074507    0.378   0.4702 
## 
## ---------------------------------------------------------------------------
## exclusion_vitalobservations 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2842521        0        2    0.276   291725   0.1026   0.1842 
## 
## ---------------------------------------------------------------------------
## exclusion_labobservations 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2842521        0        2    0.077    74972  0.02638  0.05136 
## 
## ---------------------------------------------------------------------------
## exclusion_medobservations 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2842521        0        2    0.384   428700   0.1508   0.2561 
## 
## ---------------------------------------------------------------------------
## hospitalid 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2842521        0      334        1    257.3    138.9       56       92 
##      .25      .50      .75      .90      .95 
##      167      256      365      420      445 
## 
## lowest :   1   3   4   5   6, highest: 455 456 457 458 459
## ---------------------------------------------------------------------------
## gender 
##        n  missing distinct 
##  2842521        0        5 
##                                                   
## Value               Female    Male   Other Unknown
## Frequency     4896 1309647 1527370      52     556
## Proportion   0.002   0.461   0.537   0.000   0.000
## ---------------------------------------------------------------------------
## age 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2840460     2061       91        1    62.72    19.61       28       38 
##      .25      .50      .75      .90      .95 
##       52       65       76       84       88 
## 
## lowest :  0  1  2  3  4, highest: 86 87 88 89 90
## ---------------------------------------------------------------------------
## ethnicity 
##        n  missing distinct 
##  2842521        0        7 
## 
## (47920, 0.017), African American (304105, 0.107), Asian (45050, 0.016),
## Caucasian (2152704, 0.757), Hispanic (145350, 0.051), Native American
## (25711, 0.009), Other/Unknown (121681, 0.043)
## ---------------------------------------------------------------------------
## hospital_los 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2842521        0    78285        1    8.941    9.314   0.9611   1.5028 
##      .25      .50      .75      .90      .95 
##   2.9292   5.7250  10.4799  18.6438  26.2097 
## 
## lowest : -6378.811 -6035.253 -4959.294 -4854.218 -4658.864
## highest: 31048.731 31504.512 36525.365 36527.378 36530.324
## ---------------------------------------------------------------------------
## hospital_size 
##        n  missing distinct 
##  2842521        0        5 
##                                                   
## Value                 <100 100-249 250-500    >500
## Frequency   643295  141919  533513  481826 1041968
## Proportion   0.226   0.050   0.188   0.170   0.367
## ---------------------------------------------------------------------------
## hospital_teaching_status 
##        n  missing distinct 
##  2842521        0        3 
##                                   
## Value                    f       t
## Frequency   554798 1677818  609905
## Proportion   0.195   0.590   0.215
## ---------------------------------------------------------------------------
## hospital_region 
##        n  missing distinct 
##  2842521        0        5 
##                                                             
## Value                  Midwest Northeast     South      West
## Frequency     632962    753120    165767    714254    576418
## Proportion     0.223     0.265     0.058     0.251     0.203
## ---------------------------------------------------------------------------
## hospital_discharge_disposition 
##        n  missing distinct 
##  2842521        0        8 
##                                                                   
## Value                            Death          Home   NursingHome
## Frequency          39536        264032       1697524        147773
## Proportion         0.014         0.093         0.597         0.052
##                                                                   
## Value              Other OtherExternal OtherHospital           SNF
## Frequency         136520        121664        115279        320193
## Proportion         0.048         0.043         0.041         0.113
## ---------------------------------------------------------------------------
## hospital_mortality 
##        n  missing distinct 
##  2807000    35521        2 
##                           
## Value            0       1
## Frequency  2542968  264032
## Proportion   0.906   0.094
## ---------------------------------------------------------------------------
## hospital_mortality_ultimate 
##        n  missing distinct 
##  2437440   405081        2 
##                           
## Value            0       1
## Frequency  2200750  236690
## Proportion   0.903   0.097
## ---------------------------------------------------------------------------
## hospitaladmityear 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2842521        0       26    0.988     2012    3.238     2006     2007 
##      .25      .50      .75      .90      .95 
##     2010     2012     2014     2015     2015 
## 
## lowest : 1913 1914 1917 1927 1929, highest: 2012 2013 2014 2015 2016
## ---------------------------------------------------------------------------
## hospitaldischargeyear 
##        n  missing distinct 
##  2842521        0        6 
##                                                           
## Value        -2010    2011    2012    2013    2014 2015-16
## Frequency   956304  292683  341972  357883  378924  514755
## Proportion   0.336   0.103   0.120   0.126   0.133   0.181
## ---------------------------------------------------------------------------
## icu_los 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2842521        0    46709        1    2.786    3.133   0.1139   0.3146 
##      .25      .50      .75      .90      .95 
##   0.8278   1.6104   3.0500   6.0618   9.4861 
## 
## lowest : -5.338194e+00 -1.097222e-01  0.000000e+00  6.944444e-04  1.388889e-03
## highest:  4.714410e+02  5.063722e+02  6.087215e+02  6.360187e+02  8.242104e+02
## ---------------------------------------------------------------------------
## icu_type 
##        n  missing distinct 
##  2842521        0       18 
## 
## Burn-Trauma ICU (3439, 0.001), Cardiac ICU (192048, 0.068), Cardiovascular
## ICU (12612, 0.004), CCU-CTICU (227460, 0.080), CSICU (131347, 0.046),
## CTICU (78720, 0.028), Documentation Only ICU (749, 0.000), ED ICU (27874,
## 0.010), Floating (Universal) License ICU (9064, 0.003), Med-Surg ICU
## (1527054, 0.537), MICU (248339, 0.087), Mobile ICU (5317, 0.002), Neuro
## ICU (164626, 0.058), PACU ICU (356, 0.000), SICU (179514, 0.063), Trauma
## ICU (33384, 0.012), Vent ICU (528, 0.000), Virtual ICU (90, 0.000)
## ---------------------------------------------------------------------------
## icu_admit_source 
##        n  missing distinct 
##  2842521        0       17 
## 
## (67402, 0.024), Acute Care/Floor (27695, 0.010), Chest Pain Center (9943,
## 0.003), Direct Admit (175631, 0.062), Emergency Department (1245659,
## 0.438), Emergency Room (149, 0.000), Floor (407519, 0.143), ICU (31038,
## 0.011), ICU to SDU (188944, 0.066), Observation (118, 0.000), Operating
## Room (367328, 0.129), Other (65, 0.000), Other Hospital (65765, 0.023),
## Other ICU (85071, 0.030), PACU (8412, 0.003), Recovery Room (109083,
## 0.038), Step-Down Unit (SDU) (52699, 0.019)
## ---------------------------------------------------------------------------
## icu_disch_location 
##        n  missing distinct 
##  2842521        0       18 
## 
## (4634, 0.002), Acute Care/Floor (104668, 0.037), Death (154009, 0.054),
## Floor (1587711, 0.559), Home (250587, 0.088), ICU (7465, 0.003), Nursing
## Home (3816, 0.001), Operating Room (57, 0.000), Other (25818, 0.009),
## Other External (34327, 0.012), Other Hospital (58896, 0.021), Other ICU
## (129053, 0.045), Other ICU (CABG) (974, 0.000), Other Internal (5667,
## 0.002), Rehabilitation (10269, 0.004), Skilled Nursing Facility (20506,
## 0.007), Step-Down Unit (SDU) (291173, 0.102), Telemetry (152891, 0.054)
## ---------------------------------------------------------------------------
## icu_mortality 
##        n  missing distinct 
##  2841877      644        2 
##                           
## Value            0       1
## Frequency  2687868  154009
## Proportion   0.946   0.054
## ---------------------------------------------------------------------------
## admitsource 
##        n  missing distinct     Info     Mean      Gmd 
##  2437440   405081        9    0.864     5.64    2.982 
##                                                                           
## Value           -1       1       2       3       4       5       6       7
## Frequency    56303  348455  104383    9730  448939   12995   63931  169146
## Proportion   0.023   0.143   0.043   0.004   0.184   0.005   0.026   0.069
##                   
## Value            8
## Frequency  1223558
## Proportion   0.502
## ---------------------------------------------------------------------------
## dischargelocation 
##        n  missing distinct     Info     Mean      Gmd 
##  2437440   405081        7    0.666    5.119    1.675 
##                                                                   
## Value           -1       4       5       6       7       8       9
## Frequency     3755 1685490   25106   55304  208084  312857  146844
## Proportion   0.002   0.692   0.010   0.023   0.085   0.128   0.060
## ---------------------------------------------------------------------------
## bedcount 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2437440   405081       85    0.999    26.05    15.82       10       12 
##      .25      .50      .75      .90      .95 
##       16       22       31       48       60 
## 
## lowest :   1   2   3   4   5, highest: 142 144 168 213 252
## ---------------------------------------------------------------------------
## readmit 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2437440   405081        2    0.169   145671  0.05976   0.1124 
## 
## ---------------------------------------------------------------------------
## apacheiva 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1831815  1010706      219        1    52.76    29.43       16       24 
##      .25      .50      .75      .90      .95 
##       35       49       67       88      103 
## 
## lowest :  -1   0   1   2   3, highest: 214 215 216 218 230
## ---------------------------------------------------------------------------
## apacheadmissiondx 
##        n  missing distinct 
##  2521180   321341      416 
## 
## lowest : Abdomen/extremity trauma                                                        Abdomen/face trauma                                                             Abdomen/multiple trauma                                                         Abdomen only trauma                                                             Abdomen/pelvis trauma                                                          
## highest: Vena cava filter insertion                                                      Ventricular Septal Defect (VSD) Repair                                          Ventriculostomy                                                                 Weaning from mechanical ventilation (transfer from other unit or hospital only) Whipple-surgery for pancreatic cancer                                          
## ---------------------------------------------------------------------------
## dialysis 
##        n  missing distinct 
##  2437440   405081        2 
##                           
## Value            0       1
## Frequency  2349031   88409
## Proportion   0.964   0.036
## ---------------------------------------------------------------------------
## aids 
##        n  missing distinct 
##  2437440   405081        2 
##                           
## Value            0       1
## Frequency  2434536    2904
## Proportion   0.999   0.001
## ---------------------------------------------------------------------------
## hepaticfailure 
##        n  missing distinct 
##  2437440   405081        2 
##                           
## Value        FALSE    TRUE
## Frequency  2387412   50028
## Proportion   0.979   0.021
## ---------------------------------------------------------------------------
## cirrhosis 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2437440   405081        2    0.041    34067  0.01398  0.02756 
## 
## ---------------------------------------------------------------------------
## diabetes 
##        n  missing distinct 
##  2437440   405081        2 
##                           
## Value            0       1
## Frequency  1915776  521664
## Proportion   0.786   0.214
## ---------------------------------------------------------------------------
## immunosuppression 
##        n  missing distinct 
##  2437440   405081        2 
##                           
## Value            0       1
## Frequency  2382595   54845
## Proportion   0.977   0.023
## ---------------------------------------------------------------------------
## leukemia 
##        n  missing distinct 
##  2437440   405081        2 
##                           
## Value            0       1
## Frequency  2420503   16937
## Proportion   0.993   0.007
## ---------------------------------------------------------------------------
## lymphoma 
##        n  missing distinct 
##  2437440   405081        2 
##                           
## Value            0       1
## Frequency  2427829    9611
## Proportion   0.996   0.004
## ---------------------------------------------------------------------------
## metastaticcancer 
##        n  missing distinct 
##  2437440   405081        2 
##                           
## Value            0       1
## Frequency  2391741   45699
## Proportion   0.981   0.019
## ---------------------------------------------------------------------------
## thrombolytics 
##        n  missing distinct 
##  2437440   405081        2 
##                           
## Value            0       1
## Frequency  2396625   40815
## Proportion   0.983   0.017
## ---------------------------------------------------------------------------
## admissionheight 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2699580   142941     2319    0.999    169.2    13.58    152.4    154.9 
##      .25      .50      .75      .90      .95 
##    162.5    170.0    177.8    183.0    187.0 
## 
## lowest :   0.00   0.09   0.10   0.12   0.18, highest: 712.20 712.70 715.20 717.50 720.00
## ---------------------------------------------------------------------------
## admissionweight 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2509427   333094    10426        1    83.26    27.57     49.9     55.0 
##      .25      .50      .75      .90      .95 
##     65.8     79.4     95.8    114.7    129.4 
## 
## lowest :   0.00   0.04   0.09   0.10   0.11, highest: 983.50 987.30 992.50 993.70 993.80
## ---------------------------------------------------------------------------
## chartedweight 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1347603  1494918    14441        1     83.7    27.58    49.50    55.29 
##      .25      .50      .75      .90      .95 
##    66.10    80.01    96.80   115.48   129.86 
## 
## lowest :  30.00000  30.02779  30.03000  30.04140  30.06408
## highest: 299.18928 299.37072 299.50680 299.90000 300.00000
## ---------------------------------------------------------------------------
## eyes 
##        n  missing distinct     Info     Mean      Gmd 
##  2437440   405081        5     0.66     3.28    1.147 
##                                                   
## Value           -1       1       2       3       4
## Frequency   130579  195272  102349  312300 1696940
## Proportion   0.054   0.080   0.042   0.128   0.696
## ---------------------------------------------------------------------------
## motor 
##        n  missing distinct     Info     Mean      Gmd 
##  2437440   405081        7    0.566    5.148    1.444 
##                                                                   
## Value           -1       1       2       3       4       5       6
## Frequency   130579  130349    9933   15594  117089  190116 1843780
## Proportion   0.054   0.053   0.004   0.006   0.048   0.078   0.756
## ---------------------------------------------------------------------------
## verbal 
##        n  missing distinct     Info     Mean      Gmd 
##  2437440   405081        6    0.753    3.798    1.762 
##                                                           
## Value           -1       1       2       3       4       5
## Frequency   130579  396210   52559   62431  279130 1516531
## Proportion   0.054   0.163   0.022   0.026   0.115   0.622
## ---------------------------------------------------------------------------
## gcs 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2437440   405081       14    0.807    12.23    4.297       -3        3 
##      .25      .50      .75      .90      .95 
##       11       15       15       15       15 
##                                                                           
## Value           -3       3       4       5       6       7       8       9
## Frequency   130579  116582   11175   11828   44512   54124   48652   53429
## Proportion   0.054   0.048   0.005   0.005   0.018   0.022   0.020   0.022
##                                                           
## Value           10      11      12      13      14      15
## Frequency    72618   68388   57551  105293  257068 1405641
## Proportion   0.030   0.028   0.024   0.043   0.105   0.577
## ---------------------------------------------------------------------------
## unablegcs 
##        n  missing distinct     Info     Mean      Gmd 
##  2437440   405081        3    0.152 -0.01734    0.104 
##                                   
## Value           -1       0       1
## Frequency    86425 2306861   44154
## Proportion   0.035   0.946   0.018
## ---------------------------------------------------------------------------
## urine 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2437440   405081    85117    0.877    965.4     1383       -1       -1 
##      .25      .50      .75      .90      .95 
##       -1        0     1519     2818     3780 
##                                                                          
## Value             0   200000   400000   600000   800000  1000000  3200000
## Frequency   2437411       14        6        2        2        2        1
## Proportion        1        0        0        0        0        0        0
##                             
## Value       7200000 21600000
## Frequency         1        1
## Proportion        0        0
## ---------------------------------------------------------------------------
## pao2_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2437440   405081     4882    0.542    29.52    51.53       -1       -1 
##      .25      .50      .75      .90      .95 
##       -1       -1       -1      112      167 
## 
## lowest :  -1.00   1.44   1.80   2.00   2.80, highest: 694.90 715.00 757.00 774.00 840.00
## ---------------------------------------------------------------------------
## fio2_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2437440   405081      231    0.542    12.84    22.88       -1       -1 
##      .25      .50      .75      .90      .95 
##       -1       -1       -1       50      100 
## 
## lowest :  -1.0  21.0  21.1  22.0  22.5, highest:  99.6  99.7  99.8  99.9 100.0
## ---------------------------------------------------------------------------
## pao2fio2_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2437440   405081    19815    0.542    54.91    93.48     -1.0     -1.0 
##      .25      .50      .75      .90      .95 
##     -1.0     -1.0     -1.0    247.2    338.1 
## 
## lowest :   -1.000    2.880    3.300    4.500    5.000
## highest: 2704.762 2719.048 2733.333 2804.762 2847.619
## ---------------------------------------------------------------------------
## temperature_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2437440   405081      587    0.996     32.6    7.581     -1.0     -1.0 
##      .25      .50      .75      .90      .95 
##     36.0     36.4     36.7     37.1     37.4 
## 
## lowest : -1.00 20.00 20.10 20.20 20.30, highest: 42.70 42.77 42.80 42.90 43.00
## ---------------------------------------------------------------------------
## respiratoryrate_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2437440   405081      172    0.999    23.27    17.05        4        6 
##      .25      .50      .75      .90      .95 
##       10       25       34       43       51 
## 
## lowest : -1.0  4.0  4.5  5.0  5.8, highest: 57.6 58.0 59.0 59.1 60.0
## ---------------------------------------------------------------------------
## heartrate_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2437440   405081      203        1    97.11    37.35       44       52 
##      .25      .50      .75      .90      .95 
##       70      102      119      135      145 
## 
## lowest :  -1  20  21  22  23, highest: 216 217 218 219 220
## ---------------------------------------------------------------------------
## mbp_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2437440   405081      519        1    82.31    46.77       40       43 
##      .25      .50      .75      .90      .95 
##       52       64      120      144      161 
## 
## lowest :  -1.00  40.00  40.30  40.33  41.00, highest: 196.00 197.00 198.00 199.00 200.00
## ---------------------------------------------------------------------------
## albumin_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   944241  1898280      101    0.998    2.863   0.8002      1.7      1.9 
##      .25      .50      .75      .90      .95 
##      2.4      2.9      3.4      3.8      4.0 
## 
## lowest : 1.00 1.07 1.10 1.20 1.30, highest: 7.40 7.50 7.70 8.20 8.60
## ---------------------------------------------------------------------------
## bilirubin_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2437440   405081     1175    0.725  -0.2343    1.151     -1.0     -1.0 
##      .25      .50      .75      .90      .95 
##     -1.0     -1.0      0.5      1.0      1.6 
## 
## lowest : -1.00  0.04  0.05  0.07  0.08, highest: 61.20 61.50 63.10 64.00 72.40
## ---------------------------------------------------------------------------
## bun_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2437440   405081     1068    0.987    20.23    22.21       -1       -1 
##      .25      .50      .75      .90      .95 
##        6       15       27       48       65 
## 
## lowest :  -1.00   1.00   1.40   1.41   1.50, highest: 251.00 252.00 253.00 254.00 255.00
## ---------------------------------------------------------------------------
## creatinine_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2437440   405081     2708    0.988   0.9751     1.68    -1.00    -1.00 
##      .25      .50      .75      .90      .95 
##     0.45     0.82     1.35     2.50     4.04 
## 
## lowest : -1.00  0.10  0.11  0.12  0.13, highest: 24.91 24.94 24.95 24.97 25.00
## ---------------------------------------------------------------------------
## glucose_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2437440   405081     1627    0.997    142.3    113.4       -1       -1 
##      .25      .50      .75      .90      .95 
##       85      118      191      271      337 
## 
## lowest :   -1.0    1.0    1.1    1.3    1.5, highest: 2796.0 2810.0 2871.0 2890.0 2954.0
## ---------------------------------------------------------------------------
## hematocrit_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2437440   405081      654    0.987    24.79    16.56     -1.0     -1.0 
##      .25      .50      .75      .90      .95 
##     19.6     29.9     35.9     40.2     42.6 
## 
## lowest : -1.0  5.0  5.1  5.2  5.3, highest: 78.0 79.8 80.0 86.0 93.0
## ---------------------------------------------------------------------------
## sodium_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2437440   405081      295    0.987      107     51.2       -1       -1 
##      .25      .50      .75      .90      .95 
##      128      136      140      142      145 
## 
## lowest :  -1.0  82.0  83.0  86.0  87.0, highest: 195.0 195.7 196.0 198.0 199.0
## ---------------------------------------------------------------------------
## paco2_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2437440   405081     1277    0.542    8.904    15.97     -1.0     -1.0 
##      .25      .50      .75      .90      .95 
##     -1.0     -1.0     -1.0     41.4     48.0 
## 
## lowest :  -1.0   2.5   3.1   3.4   3.7, highest: 148.8 149.0 149.3 149.6 150.0
## ---------------------------------------------------------------------------
## ph_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2437440   405081     1067    0.542    0.918    2.962   -1.000   -1.000 
##      .25      .50      .75      .90      .95 
##   -1.000   -1.000   -1.000    7.386    7.434 
## 
## -1 (1878455, 0.771), 6.3 (1, 0.000), 6.4 (1, 0.000), 6.5 (6, 0.000), 6.6
## (38, 0.000), 6.7 (116, 0.000), 6.8 (525, 0.000), 6.9 (1644, 0.001), 7
## (4136, 0.002), 7.1 (11523, 0.005), 7.2 (39474, 0.016), 7.3 (153742,
## 0.063), 7.4 (249333, 0.102), 7.5 (87884, 0.036), 7.6 (9721, 0.004), 7.7
## (780, 0.000), 7.8 (47, 0.000), 7.9 (11, 0.000), 8 (2, 0.000), 8.6 (1,
## 0.000)
## ---------------------------------------------------------------------------
## intubated_apache 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2437440   405081        2    0.364   344877   0.1415   0.2429 
## 
## ---------------------------------------------------------------------------
## wbc_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2437440   405081     6658    0.982    8.726    9.086     -1.0     -1.0 
##      .25      .50      .75      .90      .95 
##     -1.0      8.2     13.2     18.7     23.0 
## 
## lowest :  -1.00   0.01   0.02   0.03   0.04, highest: 198.10 199.00 199.20 199.40 199.69
## ---------------------------------------------------------------------------
## oobintubday1_apache 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2437440   405081        2    0.542   576561   0.2365   0.3612 
## 
## ---------------------------------------------------------------------------
## oobventday1_apache 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2437440   405081        2    0.625   720884   0.2958   0.4166 
## 
## ---------------------------------------------------------------------------
## ventday1_apache 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2437440   405081        2    0.511   530378   0.2176   0.3405 
## 
## ---------------------------------------------------------------------------
## physicianspeciality 
##        n  missing distinct 
##  2842521        0       51 
## 
## lowest :                    allergy/immunology anesthesiology     anesthesiology/CCM cardiology        
## highest: surgery-transplant surgery-trauma     surgery-vascular   unknown            urology           
## ---------------------------------------------------------------------------
## acutephysiologyscore 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1831815  1010706      202        1    41.44    26.09       11       17 
##      .25      .50      .75      .90      .95 
##       25       37       53       74       89 
## 
## lowest :  -1   0   1   2   3, highest: 196 197 198 200 206
## ---------------------------------------------------------------------------
## apachescore 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1831815  1010706      219        1    52.76    29.43       16       24 
##      .25      .50      .75      .90      .95 
##       35       49       67       88      103 
## 
## lowest :  -1   0   1   2   3, highest: 214 215 216 218 230
## ---------------------------------------------------------------------------
## predictedicumortality 
##          n    missing   distinct       Info       Mean        Gmd 
##    1831815    1010706    1692781          1 -0.0002665     0.2211 
##        .05        .10        .25        .50        .75        .90 
##  -1.000000   0.002384   0.007386   0.020175   0.058554   0.173918 
##        .95 
##   0.331791 
## 
## lowest : -1.000000e+00  2.798800e-10  5.105833e-10  5.425713e-10  5.718087e-10
## highest:  9.833071e-01  9.851197e-01  9.859533e-01  9.912570e-01  9.951461e-01
## ---------------------------------------------------------------------------
## predictediculos 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1831815  1010706  1691249        1     3.59    2.705   -1.000    1.153 
##      .25      .50      .75      .90      .95 
##    2.019    3.186    5.023    7.085    8.167 
## 
## lowest : -1.0000000000  0.0002397692  0.0005581499  0.0010462120  0.0015511424
## highest: 16.0262378684 16.4066825345 18.7383148958 19.8923078627 19.9075117024
## ---------------------------------------------------------------------------
## predictedhospitalmortality 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1831815  1010706  1608618    0.999 -0.01157   0.3362 -1.00000 -1.00000 
##      .25      .50      .75      .90      .95 
##  0.01404  0.04111  0.11272  0.27991  0.46046 
## 
## lowest : -1.0000000000  0.0002555227  0.0003451466  0.0003794773  0.0003825366
## highest:  0.9963869130  0.9979823377  0.9981384119  0.9993184841  0.9998248676
## ---------------------------------------------------------------------------
## predictedhospitallos 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1831815  1010706  1608464    0.999    8.937    6.254   -1.000   -1.000 
##      .25      .50      .75      .90      .95 
##    5.815    8.822   12.041   15.587   18.469 
## 
## lowest : -1.000000e+00  5.815364e-05  9.883428e-04  3.367056e-03  4.531164e-03
## highest:  1.288372e+02  1.331938e+02  1.469374e+02  2.234267e+02  2.249389e+02
## ---------------------------------------------------------------------------
## preopmi 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  1831815  1010706        2     0.01     6124 0.003343 0.006664 
## 
## ---------------------------------------------------------------------------
## preopcardiaccath 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  1831815  1010706        2    0.028    17018  0.00929  0.01841 
## 
## ---------------------------------------------------------------------------
## ptcawithin24h 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  1831815  1010706        2    0.177   115287  0.06294    0.118 
## 
## ---------------------------------------------------------------------------
## graftcount 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2437440   405081       10    0.044        3  0.04009        3        3 
##      .25      .50      .75      .90      .95 
##        3        3        3        3        3 
##                                                                           
## Value            1       2       3       4       5       6       7       8
## Frequency     6600   11407 2400785   13860    3894     724     128      31
## Proportion   0.003   0.005   0.985   0.006   0.002   0.000   0.000   0.000
##                           
## Value            9      10
## Frequency        7       4
## Proportion   0.000   0.000
## ---------------------------------------------------------------------------
## mbp_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2487252   355269      239        1    58.47    19.49       28       37 
##      .25      .50      .75      .90      .95 
##       48       59       70       80       86 
## 
## lowest :   1   2   3   4   5, highest: 330 342 345 353 360
## ---------------------------------------------------------------------------
## sbp_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2487021   355500      223        1    60.42    19.64       30       38 
##      .25      .50      .75      .90      .95 
##       50       60       71       82       89 
## 
## lowest :   1   2   3   4   5, highest: 290 294 302 313 347
## ---------------------------------------------------------------------------
## temperature_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   215636  2626885     2261        1    40.03    12.86    25.00    31.44 
##      .25      .50      .75      .90      .95 
##    35.00    36.10    36.90    38.20    96.80 
## 
## lowest :   0.05   0.10   0.15   0.20   0.25, highest: 116.00 117.00 122.00 131.00 137.00
## ---------------------------------------------------------------------------
## temperature_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   215636  2626885     1238    0.999    43.52    11.59     36.2     36.8 
##      .25      .50      .75      .90      .95 
##     37.3     37.8     38.5     40.7    100.0 
## 
## lowest :   0.1   0.4   1.1   1.5   1.9, highest: 157.0 168.0 173.0 176.0 224.5
## ---------------------------------------------------------------------------
## heartrate_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2533730   308791      295        1    106.9    24.84       74       80 
##      .25      .50      .75      .90      .95 
##       91      105      120      136      146 
## 
## lowest :   5   6   7   8   9, highest: 296 297 298 299 300
## ---------------------------------------------------------------------------
## respiratoryrate_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2380824   461697      210    0.998    32.07    12.85       20       21 
##      .25      .50      .75      .90      .95 
##       24       28       35       46       56 
##                                                                           
## Value            0     500    3000   13500   19000   27000   37000   51000
## Frequency  2380814       1       1       1       1       1       1       1
## Proportion       1       0       0       0       0       0       0       0
##                                   
## Value        57500   58500   63000
## Frequency        1       1       1
## Proportion       0       0       0
## ---------------------------------------------------------------------------
## heartrate_charted_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2140138   702383      314        1    100.4    24.95       68       74 
##      .25      .50      .75      .90      .95 
##       85       98      114      130      140 
## 
## lowest :   1   2   3   5   6, highest: 374 379 380 383 387
## ---------------------------------------------------------------------------
## respiratoryrate_charted_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2214083   628438       82    0.998    26.35    9.094       16       18 
##      .25      .50      .75      .90      .95 
##       20       25       30       37       43 
## 
## lowest :  1  2  3  4  5, highest: 75 76 77 78 79
## ---------------------------------------------------------------------------
## o2saturation_charted_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1988990   853531      104    0.994    92.09    6.865       81       86 
##      .25      .50      .75      .90      .95 
##       91       94       96       98       99 
## 
## lowest :   0.5   1.0   2.0   3.0   4.0, highest:  96.0  97.0  98.0  99.0 100.0
## ---------------------------------------------------------------------------
## nibp_systolic_charted_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2094497   748024      290        1    100.6    24.75       67       74 
##      .25      .50      .75      .90      .95 
##       86       99      114      129      140 
## 
## lowest :   1   2   3   4   5, highest: 263 264 266 269 278
## ---------------------------------------------------------------------------
## nibp_diastolic_charted_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2095949   746572      227        1    51.67    16.42       28       34 
##      .25      .50      .75      .90      .95 
##       42       51       60       70       77 
## 
## lowest :   1   2   3   4   5, highest: 208 213 216 226 235
## ---------------------------------------------------------------------------
## nibp_mean_charted_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2005131   837390      581        1    66.77    18.28       42       48 
##      .25      .50      .75      .90      .95 
##       56       66       77       88       95 
## 
## lowest :   0.13   0.56   0.61   0.74   0.87, highest: 215.00 219.00 223.00 232.00 242.00
## ---------------------------------------------------------------------------
## ibp_systolic_charted_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   455101  2387420      347        1    97.42    27.76       60       70 
##      .25      .50      .75      .90      .95 
##       82       95      111      130      142 
## 
## lowest :   1   2   3   4   5, highest: 346 347 348 364 390
## ---------------------------------------------------------------------------
## ibp_diastolic_charted_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   454978  2387543      297    0.999    48.81    14.45       30       34 
##      .25      .50      .75      .90      .95 
##       41       48       56       65       72 
## 
## lowest :   1.0   2.0   3.0   3.4   4.0, highest: 340.0 346.0 347.0 348.0 390.0
## ---------------------------------------------------------------------------
## ibp_mean_charted_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   482296  2360225      440        1    65.41    18.82       40       48 
##      .25      .50      .75      .90      .95 
##       56       64       74       86       94 
## 
## lowest :   0.9   1.0   2.0   3.0   4.0, highest: 359.0 360.0 362.0 364.0 390.0
## ---------------------------------------------------------------------------
## mbp_charted_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2098791   743730      668        1    65.78    18.43       41       47 
##      .25      .50      .75      .90      .95 
##       55       65       76       87       94 
## 
## lowest :   0.13   0.56   0.61   0.74   0.87, highest: 293.00 318.00 325.00 347.00 359.00
## ---------------------------------------------------------------------------
## sbp_charted_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2139934   702587      291        1    99.09    25.16       64       73 
##      .25      .50      .75      .90      .95 
##       85       98      113      128      138 
## 
## lowest :   1   2   3   4   5, highest: 256 257 260 261 264
## ---------------------------------------------------------------------------
## temperature_charted_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2358568   483953      856    0.996    36.33   0.7058     35.2     35.6 
##      .25      .50      .75      .90      .95 
##     36.1     36.4     36.7     37.0     37.2 
## 
## lowest : 20.10000 20.11111 20.20000 20.22000 20.30000
## highest: 43.30000 45.00000 45.30000 46.20000 48.20000
## ---------------------------------------------------------------------------
## temperature_charted_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2358568   483953      781    0.997    37.25   0.7737     36.3     36.6 
##      .25      .50      .75      .90      .95 
##     36.8     37.1     37.6     38.2     38.7 
## 
## lowest : 21.00 21.70 23.70 25.10 25.60, highest: 48.88 48.90 49.00 49.05 49.30
## ---------------------------------------------------------------------------
## gcs_charted_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1457027  1385494       20    0.863    12.54    3.545        3        6 
##      .25      .50      .75      .90      .95 
##       11       15       15       15       15 
## 
## 3 (95412, 0.065), 4 (8918, 0.006), 4.5 (1, 0.000), 5 (8711, 0.006), 6
## (38400, 0.026), 7 (47093, 0.032), 8 (43898, 0.030), 8.5 (1, 0.000), 9
## (41618, 0.029), 9.5 (1, 0.000), 10 (64099, 0.044), 11 (51164, 0.035), 11.5
## (1, 0.000), 12 (35063, 0.024), 13 (73406, 0.050), 13.5 (1, 0.000), 14
## (204798, 0.141), 14.5 (6, 0.000), 14.6 (1, 0.000), 15 (744435, 0.511)
## ---------------------------------------------------------------------------
## bilirubin_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1073398  1769123     1289    0.994    1.184    1.273      0.2      0.3 
##      .25      .50      .75      .90      .95 
##      0.4      0.7      1.1      2.0      3.4 
## 
## lowest :   0.00   0.04   0.05   0.06   0.07, highest:  99.00 107.00 116.80 159.00 198.00
## ---------------------------------------------------------------------------
## creatinine_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2385233   457288     3017        1    1.555    1.287     0.51     0.60 
##      .25      .50      .75      .90      .95 
##     0.77     1.00     1.57     2.98     4.67 
## 
## lowest :   0.00   0.06   0.07   0.08   0.09, highest: 220.00 241.00 335.00 363.00 405.00
## ---------------------------------------------------------------------------
## lactate_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   494007  2348514     1995    0.999    2.233    1.971      0.6      0.7 
##      .25      .50      .75      .90      .95 
##      1.0      1.5      2.3      4.1      6.4 
## 
## lowest :   0.00   0.05   0.06   0.08   0.10, highest: 199.50 215.76 222.20 265.49 557.00
## ---------------------------------------------------------------------------
## lactate_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   494007  2348514     2418    0.999    2.987    2.824    0.700    0.800 
##      .25      .50      .75      .90      .95 
##    1.200    1.900    3.300    6.200    9.444 
## 
## lowest :   0.00   0.05   0.06   0.10   0.11, highest: 244.75 251.65 278.43 509.00 557.00
## ---------------------------------------------------------------------------
## pao2_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   927841  1914680     4444        1    102.4    57.85     45.0     54.7 
##      .25      .50      .75      .90      .95 
##     67.0     84.0    115.0    167.0    218.0 
##                                                                          
## Value           0    100    200    300    400    500    600    700    800
## Frequency   66811 738900  88379  19178   9380   4364    774     40      4
## Proportion  0.072  0.796  0.095  0.021  0.010  0.005  0.001  0.000  0.000
##                                                                          
## Value         900   1000   1100   1600   2200   2500   2800   5300  11800
## Frequency       2      2      1      1      1      1      1      1      1
## Proportion  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
## ---------------------------------------------------------------------------
## pao2_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   927841  1914680     5816        1    169.1    118.1     61.0     69.0 
##      .25      .50      .75      .90      .95 
##     86.8    126.0    214.0    348.0    424.0 
##                                                                          
## Value           0    500   1000   1500   2000   2500   3000   3500   4000
## Frequency  745251 182506     52      5      7      3      3      1      1
## Proportion  0.803  0.197  0.000  0.000  0.000  0.000  0.000  0.000  0.000
##                                                                   
## Value        4500   5500   6000   7000  10000  12000  27500  31000
## Frequency       2      3      1      2      1      1      1      1
## Proportion  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
## ---------------------------------------------------------------------------
## paco2_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   924370  1918151     1400        1    38.85     12.4     23.7     27.0 
##      .25      .50      .75      .90      .95 
##     31.8     37.0     43.3     53.0     61.4 
##                                                                          
## Value        -100      0     50    100    150    200    250    300    350
## Frequency       1  59355 849661  14957    329     32      5      5      1
## Proportion  0.000  0.064  0.919  0.016  0.000  0.000  0.000  0.000  0.000
##                                                                          
## Value         400    450    500    550    750   3100   3650   3850   4550
## Frequency       4      9      4      2      1      1      1      1      1
## Proportion  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
## ---------------------------------------------------------------------------
## paco2_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   924370  1918151     1779        1    45.91    16.07     27.6     31.0 
##      .25      .50      .75      .90      .95 
##     36.0     42.9     51.0     64.6     77.0 
## 
## lowest :    0.00    2.50    2.80    3.00    3.94
## highest: 4107.00 4560.00 6537.00 7536.00 7572.00
## ---------------------------------------------------------------------------
## platelet_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2286920   555601     1377        1    201.2      103       69       94 
##      .25      .50      .75      .90      .95 
##      138      189      248      317      372 
##                                                   
## Value       -1e+05   0e+00   1e+03   2e+03   3e+03
## Frequency        1 2259260   27597      60       2
## Proportion   0.000   0.988   0.012   0.000   0.000
## ---------------------------------------------------------------------------
## inr_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1005835  1836686     1602    0.993    1.609   0.8039      1.0      1.0 
##      .25      .50      .75      .90      .95 
##      1.1      1.3      1.6      2.5      3.4 
## 
## lowest :   0.000   0.400   0.500   0.600   0.660
## highest:  58.389  76.100  79.400  81.700 130.000
## ---------------------------------------------------------------------------
## wbc_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2291098   551423     6766        1    11.27    6.306      4.3      5.4 
##      .25      .50      .75      .90      .95 
##      7.3      9.9     13.5     18.1     22.0 
## 
## lowest :   0.00   0.01   0.02   0.03   0.04, highest: 774.00 776.40 778.40 788.90 813.90
## ---------------------------------------------------------------------------
## wbc_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2291098   551423     7404        1    12.58     7.48      4.7      5.8 
##      .25      .50      .75      .90      .95 
##      7.9     10.8     14.9     20.3     24.7 
##                                           
## Value            0    5000   15000  345000
## Frequency  2291094       2       1       1
## Proportion       1       0       0       0
## ---------------------------------------------------------------------------
## ptt_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   748965  2093556     3040        1    45.34    26.29     24.0     25.7 
##      .25      .50      .75      .90      .95 
##     28.9     34.0     46.8     81.6    113.0 
##                                                                          
## Value        -200      0     50    100    150    200    250    300    350
## Frequency       1  63341 598056  59116  20435   7027    734    241      8
## Proportion  0.000  0.085  0.799  0.079  0.027  0.009  0.001  0.000  0.000
##                                       
## Value         400    600    700   2950
## Frequency       3      1      1      1
## Proportion  0.000  0.000  0.000  0.000
## ---------------------------------------------------------------------------
## bands_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   231838  2610683     1581    0.998    12.92    14.22      0.4      1.0 
##      .25      .50      .75      .90      .95 
##      3.0      8.0     18.0     32.0     43.0 
##                                              
## Value           0     50    100    200   6400
## Frequency  195803  34956   1077      1      1
## Proportion  0.845  0.151  0.005  0.000  0.000
## ---------------------------------------------------------------------------
## ph_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   915917  1926604     1241        1    7.633   0.7309    7.118    7.190 
##      .25      .50      .75      .90      .95 
##    7.280    7.350    7.409    7.453    7.480 
##                                              
## Value           0   1000   7000  70000  71000
## Frequency  915892     15      7      2      1
## Proportion      1      0      0      0      0
## ---------------------------------------------------------------------------
## basedeficit_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   144509  2698012      519    0.999    6.074     5.45      0.6      1.0 
##      .25      .50      .75      .90      .95 
##      2.4      4.8      8.0     13.0     17.0 
##                                                                       
## Value        -30   -25   -20   -15   -10    -5     0     5    10    15
## Frequency      3     8    22    43   157   379 36963 65846 24958  9350
## Proportion 0.000 0.000 0.000 0.000 0.001 0.003 0.256 0.456 0.173 0.065
##                                                           
## Value         20    25    30    35    40   100   110   405
## Frequency   4403  1893   456    24     1     1     1     1
## Proportion 0.030 0.013 0.003 0.000 0.000 0.000 0.000 0.000
## ---------------------------------------------------------------------------
## basedeficit_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   144509  2698012      519    0.999    6.074     5.45      0.6      1.0 
##      .25      .50      .75      .90      .95 
##      2.4      4.8      8.0     13.0     17.0 
##                                                                       
## Value        -30   -25   -20   -15   -10    -5     0     5    10    15
## Frequency      3     8    22    43   157   379 36963 65846 24958  9350
## Proportion 0.000 0.000 0.000 0.000 0.001 0.003 0.256 0.456 0.173 0.065
##                                                           
## Value         20    25    30    35    40   100   110   405
## Frequency   4403  1893   456    24     1     1     1     1
## Proportion 0.030 0.013 0.003 0.000 0.000 0.000 0.000 0.000
## ---------------------------------------------------------------------------
## ast_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1096980  1745541     9287        1    166.9    269.9       12       15 
##      .25      .50      .75      .90      .95 
##       20       32       67      182      411 
## 
## 0 (1090745, 0.994), 10000 (5492, 0.005), 20000 (620, 0.001), 30000 (86,
## 0.000), 40000 (21, 0.000), 50000 (4, 0.000), 60000 (2, 0.000), 110000 (1,
## 0.000), 2e+05 (1, 0.000), 210000 (1, 0.000), 260000 (1, 0.000), 440000 (1,
## 0.000), 460000 (1, 0.000), 660000 (1, 0.000), 720000 (1, 0.000), 760000
## (1, 0.000), 790000 (1, 0.000)
## ---------------------------------------------------------------------------
## alt_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1081566  1760955     6325        1    105.6    159.3       10       12 
##      .25      .50      .75      .90      .95 
##       18       29       51      122      271 
##                                                                           
## Value            0    5000   10000   15000   20000   25000   30000   65000
## Frequency  1074150    6686     653      62       5       1       1       1
## Proportion   0.993   0.006   0.001   0.000   0.000   0.000   0.000   0.000
##                                                                   
## Value       190000  255000  275000  305000  365000  385000  475000
## Frequency        1       1       1       1       1       1       1
## Proportion   0.000   0.000   0.000   0.000   0.000   0.000   0.000
## ---------------------------------------------------------------------------
## alp_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1072207  1770314     1853        1    107.4    79.26       40       46 
##      .25      .50      .75      .90      .95 
##       59       79      111      167      230 
##                                                                           
## Value            0   10000   20000  720000  790000  800000  830000  860000
## Frequency  1072192       7       1       1       1       1       2       1
## Proportion       1       0       0       0       0       0       0       0
##                   
## Value       870000
## Frequency        1
## Proportion       0
## ---------------------------------------------------------------------------
## penicilin 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2370194   472327        2    0.015    12184 0.005141  0.01023 
## 
## ---------------------------------------------------------------------------
## penicilin_anti_staph 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2370194   472327        2    0.004     2800 0.001181  0.00236 
## 
## ---------------------------------------------------------------------------
## penicilin_anti_pseudo 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2370194   472327        2    0.305   272294   0.1149   0.2034 
## 
## ---------------------------------------------------------------------------
## augmentin_unasyn 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2370194   472327        2    0.034    27425  0.01157  0.02287 
## 
## ---------------------------------------------------------------------------
## cephalosporin_1st_gen 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2370194   472327        2    0.108    89002  0.03755  0.07228 
## 
## ---------------------------------------------------------------------------
## cephalosporin_2nd_gen 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2370194   472327        2    0.086    69803  0.02945  0.05717 
## 
## ---------------------------------------------------------------------------
## cephalosporin_3rd_gen 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2370194   472327        2    0.199   169232   0.0714   0.1326 
## 
## ---------------------------------------------------------------------------
## cephalosporin_4th_5th_gen 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2370194   472327        2    0.082    66907  0.02823  0.05486 
## 
## ---------------------------------------------------------------------------
## carbapenems 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2370194   472327        2    0.076    61460  0.02593  0.05052 
## 
## ---------------------------------------------------------------------------
## monobactam 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2370194   472327        2    0.028    21995  0.00928  0.01839 
## 
## ---------------------------------------------------------------------------
## fq 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2370194   472327        2    0.234   201815  0.08515   0.1558 
## 
## ---------------------------------------------------------------------------
## vancomycin 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2370194   472327        2    0.402   377683   0.1593   0.2679 
## 
## ---------------------------------------------------------------------------
## amg 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2370194   472327        2    0.045    36180  0.01526  0.03006 
## 
## ---------------------------------------------------------------------------
## polymixins 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2370194   472327        2    0.002     1844 0.000778 0.001555 
## 
## ---------------------------------------------------------------------------
## linezolid 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2370194   472327        2    0.024    19052 0.008038  0.01595 
## 
## ---------------------------------------------------------------------------
## dapto 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2370194   472327        2    0.009     7331 0.003093 0.006167 
## 
## ---------------------------------------------------------------------------
## clinda 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2370194   472327        2    0.049    39628  0.01672  0.03288 
## 
## ---------------------------------------------------------------------------
## doxycyclin 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2370194   472327        2    0.021    16319 0.006885  0.01368 
## 
## ---------------------------------------------------------------------------
## macrolides 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2370194   472327        2    0.106    87141  0.03677  0.07083 
## 
## ---------------------------------------------------------------------------
## sulfa 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2370194   472327        2    0.023    18133  0.00765  0.01518 
## 
## ---------------------------------------------------------------------------
## metronidazole 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2370194   472327        2    0.122   101093  0.04265  0.08167 
## 
## ---------------------------------------------------------------------------
## nitrofurantoin 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2370194   472327        2    0.004     3376 0.001424 0.002845 
## 
## ---------------------------------------------------------------------------
## tigecycline 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2370194   472327        2    0.006     4855 0.002048 0.004088 
## 
## ---------------------------------------------------------------------------
## ceftriaxone 
##        n  missing distinct     Info     Mean      Gmd 
##  2370194   472327        1        0        0        0 
##                   
## Value            0
## Frequency  2370194
## Proportion       1
## ---------------------------------------------------------------------------
## cefotaxime 
##        n  missing distinct     Info     Mean      Gmd 
##  2370194   472327        1        0        0        0 
##                   
## Value            0
## Frequency  2370194
## Proportion       1
## ---------------------------------------------------------------------------
## ampicillin_sulbactam 
##        n  missing distinct     Info     Mean      Gmd 
##  2370194   472327        1        0        0        0 
##                   
## Value            0
## Frequency  2370194
## Proportion       1
## ---------------------------------------------------------------------------
## levofloxacin 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2370194   472327        2    0.047    37558  0.01585  0.03119 
## 
## ---------------------------------------------------------------------------
## moxifloxacin 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2370194   472327        2    0.004     3108 0.001311 0.002619 
## 
## ---------------------------------------------------------------------------
## piperacillin_tazobactam 
##        n  missing distinct     Info     Mean      Gmd 
##  2370194   472327        1        0        0        0 
##                   
## Value            0
## Frequency  2370194
## Proportion       1
## ---------------------------------------------------------------------------
## cefepim 
##        n  missing distinct     Info     Mean      Gmd 
##  2370194   472327        1        0        0        0 
##                   
## Value            0
## Frequency  2370194
## Proportion       1
## ---------------------------------------------------------------------------
## meropenem 
##        n  missing distinct     Info     Mean      Gmd 
##  2370194   472327        1        0        0        0 
##                   
## Value            0
## Frequency  2370194
## Proportion       1
## ---------------------------------------------------------------------------
## imipenem 
##        n  missing distinct     Info     Mean      Gmd 
##  2370194   472327        1        0        0        0 
##                   
## Value            0
## Frequency  2370194
## Proportion       1
## ---------------------------------------------------------------------------
## doripenem 
##        n  missing distinct     Info     Mean      Gmd 
##  2370194   472327        1        0        0        0 
##                   
## Value            0
## Frequency  2370194
## Proportion       1
## ---------------------------------------------------------------------------
## gentamicin 
##         n   missing  distinct      Info       Sum      Mean       Gmd 
##   2370194    472327         2         0        47 1.983e-05 3.966e-05 
## 
## ---------------------------------------------------------------------------
## tobramycin 
##         n   missing  distinct      Info       Sum      Mean       Gmd 
##   2370194    472327         2         0       349 0.0001472 0.0002944 
## 
## ---------------------------------------------------------------------------
## amikacin 
##        n  missing distinct     Info     Mean      Gmd 
##  2370194   472327        1        0        0        0 
##                   
## Value            0
## Frequency  2370194
## Proportion       1
## ---------------------------------------------------------------------------
## dopamine_infusion 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2842521        0        2     0.06    58203  0.02048  0.04011 
## 
## ---------------------------------------------------------------------------
## epinephrine_infusion 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2842521        0        2    0.024    23201 0.008162  0.01619 
## 
## ---------------------------------------------------------------------------
## norepinephrine_infusion 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2842521        0        2    0.172   173100   0.0609   0.1144 
## 
## ---------------------------------------------------------------------------
## phenylephrine_infusion 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2842521        0        2     0.06    58403  0.02055  0.04025 
## 
## ---------------------------------------------------------------------------
## vasopressin_infusion 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   836528  2005993        2     0.12    34844  0.04165  0.07984 
## 
## ---------------------------------------------------------------------------
## milrinone_infusion 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2842521        0        2    0.018    16945 0.005961  0.01185 
## 
## ---------------------------------------------------------------------------
## heparin_infusion 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   836528  2005993        2      0.3    94183   0.1126   0.1998 
## 
## ---------------------------------------------------------------------------
## dopamine_medication 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2842521        0        2    0.138   137414  0.04834  0.09201 
## 
## ---------------------------------------------------------------------------
## epinephrine_medication 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2842521        0        2    0.106   104423  0.03674  0.07077 
## 
## ---------------------------------------------------------------------------
## norepinephrine_medication 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2842521        0        2    0.233   241746  0.08505   0.1556 
## 
## ---------------------------------------------------------------------------
## phenylephrine_medication 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2842521        0        2    0.122   120575  0.04242  0.08124 
## 
## ---------------------------------------------------------------------------
## vasopressin_medication 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2370194   472327        2     0.11    90744  0.03829  0.07364 
## 
## ---------------------------------------------------------------------------
## milrinone_medication 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2842521        0        2    0.028    26753 0.009412  0.01865 
## 
## ---------------------------------------------------------------------------
## heparin_medication 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2370194   472327        2    0.525   536475   0.2263   0.3502 
## 
## ---------------------------------------------------------------------------
## sepsis 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2391341   451180        2    0.321   291609   0.1219   0.2141 
## 
## ---------------------------------------------------------------------------
## sepsis_priority 
##        n  missing distinct     Info     Mean      Gmd 
##  2391341   451180        4    0.323   0.1929   0.3507 
##                                           
## Value            0       1       2       3
## Frequency  2099732  182938   47553   61118
## Proportion   0.878   0.077   0.020   0.026
## ---------------------------------------------------------------------------
## infection 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2391341   451180        2    0.597   655487   0.2741   0.3979 
## 
## ---------------------------------------------------------------------------
## infection_priority 
##        n  missing distinct     Info     Mean      Gmd 
##  2391341   451180        4    0.614   0.4882   0.7754 
##                                           
## Value            0       1       2       3
## Frequency  1735854  316115  166797  172575
## Proportion   0.726   0.132   0.070   0.072
## ---------------------------------------------------------------------------
## aidshiv 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2391341   451180        2    0.011     9008 0.003767 0.007505 
## 
## ---------------------------------------------------------------------------
## aidshiv_priority 
##        n  missing distinct     Info     Mean      Gmd 
##  2391341   451180        4    0.011 0.009231   0.0184 
##                                           
## Value            0       1       2       3
## Frequency  2382333     180    4590    4238
## Proportion   0.996   0.000   0.002   0.002
## ---------------------------------------------------------------------------
## organfailure 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2391341   451180        2    0.719   954040    0.399   0.4796 
## 
## ---------------------------------------------------------------------------
## organfailure_priority 
##        n  missing distinct     Info     Mean      Gmd 
##  2391341   451180        4    0.775   0.7306    1.019 
##                                           
## Value            0       1       2       3
## Frequency  1437301  418134  278763  257143
## Proportion   0.601   0.175   0.117   0.108
## ---------------------------------------------------------------------------
## altered_mental_status 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2391341   451180        2    0.244   213500  0.08928   0.1626 
## 
## ---------------------------------------------------------------------------
## altered_mental_status_priority 
##        n  missing distinct     Info     Mean      Gmd 
##  2391341   451180        4    0.245    0.195   0.3614 
##                                           
## Value            0       1       2       3
## Frequency  2177841   41341   91502   80657
## Proportion   0.911   0.017   0.038   0.034
## ---------------------------------------------------------------------------
## infection_apache 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2437440   405081        2    0.392   377006   0.1547   0.2615 
## 
## ---------------------------------------------------------------------------
## organfailure_apache 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2437440   405081        2     0.16   138153  0.05668   0.1069 
## 
## ---------------------------------------------------------------------------
## prompt_inflam 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   798808  2043713        2    0.493   165756   0.2075   0.3289 
## 
## ---------------------------------------------------------------------------
## prompt_severe_sepsis 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   798808  2043713        2    0.222    64231  0.08041   0.1479 
## 
## ---------------------------------------------------------------------------
## prompt_sepsis 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   798808  2043713        2    0.103    28309  0.03544  0.06837 
## 
## ---------------------------------------------------------------------------
## prompt_inflam_with_org_dys 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   798808  2043713        2    0.009     2323 0.002908 0.005799 
## 
## ---------------------------------------------------------------------------
## prompt_clinical_respone_req 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   798808  2043713        2    0.007   796984   0.9977 0.004556 
## 
## ---------------------------------------------------------------------------
## sofa_respiration 
##        n  missing distinct     Info     Mean      Gmd 
##  2842521        0        5     0.32   0.2906   0.5244 
##                                                   
## Value            0       1       2       3       4
## Frequency  2498811   45660  154287  103252   40511
## Proportion   0.879   0.016   0.054   0.036   0.014
## ---------------------------------------------------------------------------
## sofa_coagulation 
##        n  missing distinct     Info     Mean      Gmd 
##  2842521        0        5    0.561   0.3582   0.5818 
##                                                   
## Value            0       1       2       3       4
## Frequency  2153931  431349  197458   47111   12672
## Proportion   0.758   0.152   0.069   0.017   0.004
## ---------------------------------------------------------------------------
## sofa_liver 
##        n  missing distinct     Info     Mean      Gmd 
##  2842521        0        5    0.238   0.1393   0.2601 
##                                                   
## Value            0       1       2       3       4
## Frequency  2595771  132730   88556   15751    9713
## Proportion   0.913   0.047   0.031   0.006   0.003
## ---------------------------------------------------------------------------
## sofa_cardiovascular 
##        n  missing distinct     Info     Mean      Gmd 
##  2842521        0        3    0.824        1   0.9772 
##                                   
## Value            0       1       3
## Frequency   915581 1469117  457823
## Proportion   0.322   0.517   0.161
## ---------------------------------------------------------------------------
## sofa_cns 
##        n  missing distinct     Info     Mean      Gmd 
##  2842521        0        5    0.679   0.6754    1.044 
##                                                   
## Value            0       1       2       3       4
## Frequency  1941301  362361  198557  200717  139585
## Proportion   0.683   0.127   0.070   0.071   0.049
## ---------------------------------------------------------------------------
## sofa_renal 
##        n  missing distinct     Info     Mean      Gmd 
##  2842521        0        5    0.731   0.7193    1.078 
##                                                   
## Value            0       1       2       3       4
## Frequency  1822342  490015  204535  156907  168722
## Proportion   0.641   0.172   0.072   0.055   0.059
## ---------------------------------------------------------------------------
## sofa_renal_baseline 
##        n  missing distinct     Info     Mean      Gmd 
##  2842521        0        2     0.09   0.1244   0.2411 
##                           
## Value            0       4
## Frequency  2754112   88409
## Proportion   0.969   0.031
## ---------------------------------------------------------------------------
## sofa_liver_baseline 
##        n  missing distinct     Info     Mean      Gmd 
##  2842521        0        2    0.052   0.0704   0.1383 
##                           
## Value            0       4
## Frequency  2792493   50028
## Proportion   0.982   0.018
## ---------------------------------------------------------------------------
## sofa_respiration_baseline 
##        n  missing distinct     Info     Mean      Gmd 
##  2842521        0        2    0.483    0.403   0.6436 
##                           
## Value            0       2
## Frequency  2269755  572766
## Proportion   0.799   0.201
## ---------------------------------------------------------------------------
## cardiovascular_baseline 
##        n  missing distinct 
##  2842521        0        2 
##                           
## Value            0       1
## Frequency  2290527  551994
## Proportion   0.806   0.194
## ---------------------------------------------------------------------------
## soi_alpha 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1670335  1172186      487    0.999    2.976   0.5121     2.50     2.52 
##      .25      .50      .75      .90      .95 
##     2.60     2.83     3.14     3.67     4.00 
## 
## lowest : 2.50 2.51 2.52 2.53 2.54, highest: 7.83 7.85 7.88 7.94 8.00
## ---------------------------------------------------------------------------
## soi_minutes 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1670335  1172186      301    0.996    196.7    316.8      -60      -60 
##      .25      .50      .75      .90      .95 
##        0       45      265      735      990 
## 
## lowest :  -60  -55  -50  -45  -40, highest: 1420 1425 1430 1435 1440
## ---------------------------------------------------------------------------
## od_alpha 
##        n  missing distinct     Info     Mean      Gmd 
##  2107497   735024        7    0.328    1.156   0.2804 
##                                                                   
## Value            1       2       3       4       5       6       7
## Frequency  1845543  206506   44828    9213    1289     113       5
## Proportion   0.876   0.098   0.021   0.004   0.001   0.000   0.000
## ---------------------------------------------------------------------------
## od_minutes 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2107497   735024      301    0.967    161.3    301.4      -60      -60 
##      .25      .50      .75      .90      .95 
##      -60       20      225      650      930 
## 
## lowest :  -60  -55  -50  -45  -40, highest: 1420 1425 1430 1435 1440
## ---------------------------------------------------------------------------
## both_soi_alpha 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1319513  1523008      501    0.999    3.091   0.6139     2.50     2.53 
##      .25      .50      .75      .90      .95 
##     2.65     2.94     3.33     3.99     4.29 
## 
## lowest : 2.50 2.51 2.52 2.53 2.54, highest: 7.88 7.94 7.95 8.00 9.00
## ---------------------------------------------------------------------------
## both_od_alpha 
##        n  missing distinct     Info     Mean      Gmd 
##  1319513  1523008        7    0.656    1.426   0.6452 
##                                                            
## Value           1      2      3      4      5      6      7
## Frequency  915364 278194  98368  23520   3753    307      7
## Proportion  0.694  0.211  0.075  0.018  0.003  0.000  0.000
## ---------------------------------------------------------------------------
## both_minutes 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1319513  1523008      301    0.997    243.1    359.5      -60      -60 
##      .25      .50      .75      .90      .95 
##        5       80      375      840     1075 
## 
## lowest :  -60  -55  -50  -45  -40, highest: 1420 1425 1430 1435 1440
## ---------------------------------------------------------------------------
## soi_alteredmentalstatus 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  1670335  1172186        2    0.136    79212  0.04742  0.09035 
## 
## ---------------------------------------------------------------------------
## soi_glucose 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1670335  1172186      121    0.866   0.5885   0.4758   0.0000   0.0000 
##      .25      .50      .75      .90      .95 
##   0.0000   0.8667   1.0000   1.0000   1.0000 
## 
## lowest : 0.00000000 0.01000000 0.02000000 0.03000000 0.03333333
## highest: 0.96666667 0.97000000 0.98000000 0.99000000 1.00000000
## ---------------------------------------------------------------------------
## soi_heartrate 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1670335  1172186       22    0.896   0.6656   0.4201      0.0      0.0 
##      .25      .50      .75      .90      .95 
##      0.3      0.9      1.0      1.0      1.0 
## 
## lowest : 0.000 0.050 0.100 0.150 0.200, highest: 0.850 0.900 0.925 0.950 1.000
## ---------------------------------------------------------------------------
## soi_inr 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1670335  1172186      154    0.571   0.1618    0.267        0        0 
##      .25      .50      .75      .90      .95 
##        0        0        0        1        1 
## 
## lowest : 0.00000000 0.01333333 0.01666667 0.02000000 0.03333333
## highest: 0.96666667 0.98333333 0.99666667 0.99833333 1.00000000
## ---------------------------------------------------------------------------
## soi_respiratoryrate 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1670335  1172186       64     0.96   0.6453   0.3911   0.0000   0.0000 
##      .25      .50      .75      .90      .95 
##   0.4167   0.7500   1.0000   1.0000   1.0000 
## 
## lowest : 0.000000000 0.008333333 0.027777778 0.041666667 0.083333333
## highest: 0.944444444 0.958333333 0.972222222 0.983333333 1.000000000
## ---------------------------------------------------------------------------
## soi_temperature 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1670335  1172186      309    0.689    0.152    0.244   0.0000   0.0000 
##      .25      .50      .75      .90      .95 
##   0.0000   0.0000   0.1765   0.6471   1.0000 
## 
## lowest : 0.000000000 0.001764706 0.016470588 0.028000000 0.029411765
## highest: 0.980588235 0.982235294 0.982352941 0.997160000 1.000000000
## ---------------------------------------------------------------------------
## soi_bands 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1670335  1172186      304    0.187   0.0553   0.1044   0.0000   0.0000 
##      .25      .50      .75      .90      .95 
##   0.0000   0.0000   0.0000   0.0000   0.6667 
## 
## lowest : 0.00000000 0.00500000 0.01166667 0.01666667 0.01833333
## highest: 0.97833333 0.98000000 0.98333333 0.99833333 1.00000000
## ---------------------------------------------------------------------------
## soi_wbc 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1670335  1172186      602     0.94   0.5357   0.4702   0.0000   0.0000 
##      .25      .50      .75      .90      .95 
##   0.0000   0.5933   1.0000   1.0000   1.0000 
## 
## lowest : 0.000000000 0.001666667 0.003333333 0.005000000 0.006666667
## highest: 0.993333333 0.995000000 0.996666667 0.998333333 1.000000000
## ---------------------------------------------------------------------------
## soi_lactate 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  1670335  1172186        2    0.325   206734   0.1238   0.2169 
## 
## ---------------------------------------------------------------------------
## od_liver 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2107497   735024        2    0.307   244230   0.1159   0.2049 
## 
## ---------------------------------------------------------------------------
## od_cardiovascular 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2107497   735024        2    0.738  1186809   0.5631    0.492 
## 
## ---------------------------------------------------------------------------
## od_respiratory 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2107497   735024        2    0.413   347194   0.1647   0.2752 
## 
## ---------------------------------------------------------------------------
## od_kidney 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2107497   735024        2     0.19   142849  0.06778   0.1264 
## 
## ---------------------------------------------------------------------------
## od_lactate 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2107497   735024        2    0.258   199997   0.0949   0.1718 
## 
## ---------------------------------------------------------------------------
## od_metabolic 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2107497   735024        2    0.369   303131   0.1438   0.2463 
## 
## ---------------------------------------------------------------------------
## od_hematologic 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2107497   735024        2    0.018    12839 0.006092  0.01211 
## 
## ---------------------------------------------------------------------------
## both_soi_alteredmentalstatus 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  1319513  1523008        2    0.119    54680  0.04144  0.07944 
## 
## ---------------------------------------------------------------------------
## both_soi_glucose 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1319513  1523008      121    0.865   0.5751    0.481   0.0000   0.0000 
##      .25      .50      .75      .90      .95 
##   0.0000   0.8333   1.0000   1.0000   1.0000 
## 
## lowest : 0.00000000 0.01000000 0.02000000 0.03000000 0.03333333
## highest: 0.96666667 0.97000000 0.98000000 0.99000000 1.00000000
## ---------------------------------------------------------------------------
## both_soi_heartrate 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1319513  1523008       22    0.885   0.6672    0.422      0.0      0.0 
##      .25      .50      .75      .90      .95 
##      0.3      0.9      1.0      1.0      1.0 
## 
## lowest : 0.000 0.050 0.100 0.150 0.200, highest: 0.850 0.900 0.925 0.950 1.000
## ---------------------------------------------------------------------------
## both_soi_inr 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1319513  1523008      141    0.632    0.186   0.2969   0.0000   0.0000 
##      .25      .50      .75      .90      .95 
##   0.0000   0.0000   0.1667   1.0000   1.0000 
## 
## lowest : 0.00000000 0.01666667 0.02000000 0.03333333 0.03833333
## highest: 0.95000000 0.96666667 0.98333333 0.99833333 1.00000000
## ---------------------------------------------------------------------------
## both_soi_respiratoryrate 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1319513  1523008       61    0.954   0.6495   0.3954   0.0000   0.0000 
##      .25      .50      .75      .90      .95 
##   0.4167   0.7500   1.0000   1.0000   1.0000 
## 
## lowest : 0.000000000 0.008333333 0.027777778 0.041666667 0.055555556
## highest: 0.933333333 0.944444444 0.958333333 0.972222222 1.000000000
## ---------------------------------------------------------------------------
## both_soi_temperature 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1319513  1523008      300    0.716   0.1635   0.2584      0.0      0.0 
##      .25      .50      .75      .90      .95 
##      0.0      0.0      0.2      0.7      1.0 
## 
## lowest : 0.000000000 0.001764706 0.028000000 0.029411765 0.031176471
## highest: 0.980588235 0.982235294 0.982352941 0.997160000 1.000000000
## ---------------------------------------------------------------------------
## both_soi_bands 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1319513  1523008      272    0.217  0.06554   0.1223        0        0 
##      .25      .50      .75      .90      .95 
##        0        0        0        0        1 
## 
## lowest : 0.000000000 0.005000000 0.008333333 0.011666667 0.016666667
## highest: 0.966666667 0.980000000 0.983333333 0.998333333 1.000000000
## ---------------------------------------------------------------------------
## both_soi_wbc 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1319513  1523008      602    0.932   0.5755    0.462   0.0000   0.0000 
##      .25      .50      .75      .90      .95 
##   0.0500   0.6833   1.0000   1.0000   1.0000 
## 
## lowest : 0.000000000 0.001666667 0.003333333 0.005000000 0.006666667
## highest: 0.993333333 0.995000000 0.996666667 0.998333333 1.000000000
## ---------------------------------------------------------------------------
## both_soi_lactate 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  1319513  1523008        2    0.417   220210   0.1669   0.2781 
## 
## ---------------------------------------------------------------------------
## both_od_liver 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  1319513  1523008        2    0.425   225493   0.1709   0.2834 
## 
## ---------------------------------------------------------------------------
## both_od_cardiovascular 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  1319513  1523008        2    0.744   720954   0.5464   0.4957 
## 
## ---------------------------------------------------------------------------
## both_od_respiratory 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  1319513  1523008        2    0.553   321698   0.2438   0.3687 
## 
## ---------------------------------------------------------------------------
## both_od_kidney 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  1319513  1523008        2    0.201    95231  0.07217   0.1339 
## 
## ---------------------------------------------------------------------------
## both_od_lactate 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  1319513  1523008        2    0.417   220210   0.1669   0.2781 
## 
## ---------------------------------------------------------------------------
## both_od_metabolic 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  1319513  1523008        2    0.505   282908   0.2144   0.3369 
## 
## ---------------------------------------------------------------------------
## both_od_hematologic 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  1319513  1523008        2    0.034    15098  0.01144  0.02262 
## 
## ---------------------------------------------------------------------------
## patientweight 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2600179   242342    17020        1    83.24    27.65    49.50    55.00 
##      .25      .50      .75      .90      .95 
##    65.70    79.42    96.00   114.90   129.50 
## 
## lowest :   0.00   0.09   0.17   0.20   0.22, highest: 956.00 967.00 969.00 992.50 993.70
## ---------------------------------------------------------------------------
## BMI 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2532267   310254   308878        1      Inf      NaN    18.47    20.22 
##      .25      .50      .75      .90      .95 
##    23.39    27.44    32.69    39.36    44.82 
##                                                                           
## Value      0.0e+00 1.0e+06 2.0e+06 8.0e+06 9.0e+06 1.3e+07 3.1e+07 3.4e+07
## Frequency  2530160      81       4       1       1       1       1       1
## Proportion   0.999   0.000   0.000   0.000   0.000   0.000   0.000   0.000
##                           
## Value      8.6e+07     Inf
## Frequency        1    2016
## Proportion   0.000   0.001
## ---------------------------------------------------------------------------
## BMI_Ranges 
##        n  missing distinct 
##  2842521        0        5 
##                                                                   
## Value           (0,18.5]     (18.5,25]       (25,35]      (35,200]
## Frequency         128213        753213       1191774        453265
## Proportion         0.045         0.265         0.419         0.159
##                         
## Value      Other/Unknown
## Frequency         316056
## Proportion         0.111
## ---------------------------------------------------------------------------
## age_Ranges 
##        n  missing distinct 
##  2839897     2624        8 
##                                                                          
## Value        (0,25]  (25,35]  (35,45]  (45,55]  (55,65]  (65,75]  (75,85]
## Frequency    105109   141150   215032   421325   585296   621393   526359
## Proportion    0.037    0.050    0.076    0.148    0.206    0.219    0.185
##                    
## Value      (85,100]
## Frequency    224233
## Proportion    0.079
## ---------------------------------------------------------------------------
## hospitalLOS_Ranges 
##        n  missing distinct 
##  2839140     3381       10 
##                                                                       
## Value          (0,1]     (1,3]     (3,5]    (5,10]   (10,20]   (20,30]
## Frequency     150460    582206    529927    820698    507248    143837
## Proportion     0.053     0.205     0.187     0.289     0.179     0.051
##                                                   
## Value        (30,60]   (60,90]  (90,150] (150,999]
## Frequency      85601     12058      4741      2364
## Proportion     0.030     0.004     0.002     0.001
## ---------------------------------------------------------------------------
## icuLOS_Ranges 
##        n  missing distinct 
##  2826779    15742        8 
##                                                                          
## Value         (0,1]    (1,3]    (3,5]   (5,10]  (10,20]  (20,30]  (30,60]
## Frequency    928888  1168923   352746   247099    99566    20292     8379
## Proportion    0.329    0.414    0.125    0.087    0.035    0.007    0.003
##                    
## Value      (60,999]
## Frequency       886
## Proportion    0.000
## ---------------------------------------------------------------------------
## ethnicity2 
##        n  missing distinct 
##  2842521        0        6 
##                                                              
## Value             Caucasian African American         Hispanic
## Frequency           2152704           304105           145350
## Proportion            0.757            0.107            0.051
##                                                              
## Value                 Asian  Native American    Other/Unknown
## Frequency             45050            25711           169601
## Proportion            0.016            0.009            0.060
## ---------------------------------------------------------------------------
## gender2 
##        n  missing distinct 
##  2842521        0        3 
##                                                     
## Value               Male        Female Other/Unknown
## Frequency        1527370       1309647          5504
## Proportion         0.537         0.461         0.002
## ---------------------------------------------------------------------------
## hospital_region2 
##        n  missing distinct 
##  2842521        0        5 
##                                                             
## Value        Midwest Northeast     South      West   Unknown
## Frequency     753120    165767    714254    576418    632962
## Proportion     0.265     0.058     0.251     0.203     0.223
## ---------------------------------------------------------------------------
## sepsis_outcome 
##        n  missing distinct 
##  2391341   451180        2 
##                           
## Value        FALSE    TRUE
## Frequency  1906183  485158
## Proportion   0.797   0.203
## ---------------------------------------------------------------------------
## group 
##        n  missing distinct 
##  2833373     9148       12 
## 
## Cardiovascular (839352, 0.296), Gastrointestinal (266781, 0.094),
## Gynaecological (6754, 0.002), Hematological (18705, 0.007), Metabolic
## (193873, 0.068), Muscoskeletal/Skin disease (35740, 0.013), Neurological
## (323997, 0.114), Renal/Genitourinary (61926, 0.022), Respiratory (381474,
## 0.135), Sepsis (571651, 0.202), Trauma (111731, 0.039), Undefined (21389,
## 0.008)
## ---------------------------------------------------------------------------
## post.operative 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2833373     9148        2    0.423   480702   0.1697   0.2817 
## 
## ---------------------------------------------------------------------------
## code 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2833373     9148      379    0.998    527.3    454.5      104      106 
##      .25      .50      .75      .90      .95 
##      206      410      702     1208     1408 
## 
## lowest :    0.01    0.02    0.03    0.04    0.05
## highest: 2201.01 2201.02 2201.03 2201.04 2201.05
## ---------------------------------------------------------------------------
## dx 
##        n  missing distinct 
##  2833373     9148      379 
## 
## lowest : Abdomen/extremity trauma                                                        Abdomen/face trauma                                                             Abdomen/multiple trauma                                                         Abdomen only trauma                                                             Abdomen/pelvis trauma                                                          
## highest: Vena cava clipping                                                              Vena cava filer insertion                                                       Ventriculostomy                                                                 Weaning from mechanical ventilation (transfer from other unit or hospital only) Whipple surgery for pancreatic cancer                                          
## ---------------------------------------------------------------------------
## number 
##        n  missing distinct     Info     Mean      Gmd 
##  2833373     9148        6    0.155    1.134   0.2576 
##                                                           
## Value            1       2       3       4       5       6
## Frequency  2679142   48853   30056   41793   22294   11235
## Proportion   0.946   0.017   0.011   0.015   0.008   0.004
## ---------------------------------------------------------------------------
## admitdiagnosis 
##        n  missing distinct 
##  2833373     9148      402 
## 
## lowest : ACIDBASE   ACUHEPFAIL ADDISON    ADRENNEO   AIROBSTRX 
## highest: UNSTANGINA VARICBLEED VASCULITIS VIRALMYOSI WEANVENT  
## ---------------------------------------------------------------------------
## admitdxpath 
##        n  missing distinct 
##  2833373     9148      402 
## 
## lowest :                                                                                                                                      admission diagnosis|All Diagnosis|Non-operative|Diagnosis|Cardiovascular|Anaphylaxis                                                 admission diagnosis|All Diagnosis|Non-operative|Diagnosis|Cardiovascular|Aneurysm, dissecting aortic                                 admission diagnosis|All Diagnosis|Non-operative|Diagnosis|Cardiovascular|Aneurysm/pseudoaneurysm, other                              admission diagnosis|All Diagnosis|Non-operative|Diagnosis|Cardiovascular|Angina, stable (asymp or stable pattern of symptoms w/meds)
## highest: admission diagnosis|All Diagnosis|Operative|Diagnosis|Trauma|Extremity/multiple trauma, surgery for                                  admission diagnosis|All Diagnosis|Operative|Diagnosis|Trauma|Extremity only trauma, surgery for                                      admission diagnosis|All Diagnosis|Operative|Diagnosis|Trauma|Face/multiple trauma, surgery for                                       admission diagnosis|All Diagnosis|Operative|Diagnosis|Trauma|Face only trauma, surgery for                                           admission diagnosis|All Diagnosis|Operative|Diagnosis|Trauma|Trauma surgery, other                                                  
## ---------------------------------------------------------------------------
## numobs 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2512032   330489      235        1     2519     2558       43      129 
##      .25      .50      .75      .90      .95 
##      484     1819     4354     6262     6790 
## 
## lowest :    0    1    2    3    4, highest: 5003 5989 6262 6790 8375
## ---------------------------------------------------------------------------
## possible.group 
##        n  missing distinct     Info     Mean      Gmd 
##    20200  2822321        8    0.887    975.9    602.3 
##                                                                           
## Value       312.00  408.02  602.09  802.00 1208.00 1504.00 1701.00 1705.03
## Frequency     6838    1331      66    1188    1258    8471     446     602
## Proportion   0.339   0.066   0.003   0.059   0.062   0.419   0.022   0.030
## ---------------------------------------------------------------------------
## X 
##        n  missing distinct 
##  2833373     9148       13 
## 
## lowest :                                                                                                ANZICS addition                                                                                ANZICS Addition. Sub-categories won’t map well, but collapsing to hierarchy (1206) should work ANZICS addition – we have invented this diagnosis code                                         assumes admitted in eICU due to rejection                                                     
## highest: Chest pain, unknown origin                                                                     fuzzy match                                                                                    multiple matches                                                                               presumably ANZICS only allows the surgical version of this code                                there are 6 categories for this in eICU                                                       
## ---------------------------------------------------------------------------
## c_temp_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2522673   319848     1765    0.996    36.42   0.9129     35.2     35.6 
##      .25      .50      .75      .90      .95 
##     36.1     36.4     36.7     37.0     37.2 
## 
## lowest :   0.10   0.20   0.50   0.60   0.75, highest: 103.00 103.20 103.30 103.50 108.30
## ---------------------------------------------------------------------------
## c_temp_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2522673   319848     1226    0.997    37.31   0.9948     36.2     36.5 
##      .25      .50      .75      .90      .95 
##     36.8     37.1     37.6     38.2     38.7 
## 
## lowest :   0.10   2.00   4.70  11.00  11.85, highest: 110.00 110.40 111.20 112.05 112.60
## ---------------------------------------------------------------------------
## c_HR_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2730479   112042      314        1    101.4    25.05       68       74 
##      .25      .50      .75      .90      .95 
##       86       99      115      131      141 
## 
## lowest :   1   2   3   5   6, highest: 374 379 380 383 387
## ---------------------------------------------------------------------------
## c_resp_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2707796   134725      201    0.998    26.98    9.668       16       18 
##      .25      .50      .75      .90      .95 
##       21       25       30       38       44 
## 
## lowest :   1   2   3   4   5, highest: 194 196 197 199 200
## ---------------------------------------------------------------------------
## c_sbp_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2643599   198922      299        1    92.01    29.63       48       58 
##      .25      .50      .75      .90      .95 
##       75       92      109      125      136 
## 
## lowest :   1   2   3   4   5, highest: 290 294 302 313 347
## ---------------------------------------------------------------------------
## c_mbp_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2592405   250116      680        1    70.12    24.33       42       47 
##      .25      .50      .75      .90      .95 
##       56       66       78       97      120 
## 
## lowest :   0.13   0.56   0.61   0.74   0.87, highest: 293.00 318.00 325.00 347.00 359.00
## ---------------------------------------------------------------------------
## icu_admit_source2 
##        n  missing distinct 
##  2842521        0        6 
##                                                                          
## Value                     Floor         OR/Proc Area         Direct Admit
## Frequency                435214               494766               241396
## Proportion                0.153                0.174                0.085
##                                                                          
## Value      Emergency Department                Other       Step-Down Unit
## Frequency               1245659               183843               241643
## Proportion                0.438                0.065                0.085
## ---------------------------------------------------------------------------
## icu_type2 
##        n  missing distinct 
##  2842521        0        8 
## 
## Trauma ICU (36823, 0.013), Cardiac Care ICU (192048, 0.068),
## Cardiac/Surgical Care ICU (437527, 0.154), Medical/Surgical ICU (1527054,
## 0.537), Medical ICU (248339, 0.087), Other ICU (56590, 0.020), Neuro ICU
## (164626, 0.058), Surgical ICU (179514, 0.063)
## ---------------------------------------------------------------------------
## icu_disch_location2 
##        n  missing distinct 
##  2842521        0        7 
##                                                                       
## Value               Floor          Death           Home      SNF/Rehab
## Frequency         1850937         154009         250587          34591
## Proportion          0.651          0.054          0.088          0.012
##                                                        
## Value               Other Other Hospital Step-Down Unit
## Frequency          202328          58896         291173
## Proportion          0.071          0.021          0.102
## ---------------------------------------------------------------------------
## physicianSpeciality2 
##        n  missing distinct 
##  2842521        0        2 
##                                             
## Value         Critical Care Speciality-Other
## Frequency            473200          2369321
## Proportion            0.166            0.834
## ---------------------------------------------------------------------------
## sofa_respiration_baseline2 
##        n  missing distinct 
##  2842521        0        2 
##                           
## Value        FALSE    TRUE
## Frequency  2269755  572766
## Proportion   0.799   0.201
## ---------------------------------------------------------------------------
## sofa_renal_baseline2 
##        n  missing distinct 
##  2842521        0        2 
##                           
## Value        FALSE    TRUE
## Frequency  2754112   88409
## Proportion   0.969   0.031
## ---------------------------------------------------------------------------
## sofa_liver_baseline2 
##        n  missing distinct 
##  2842521        0        2 
##                           
## Value        FALSE    TRUE
## Frequency  2792493   50028
## Proportion   0.982   0.018
## ---------------------------------------------------------------------------
## SOFA_Change 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2842521        0       24    0.976    2.975    2.964        0        0 
##      .25      .50      .75      .90      .95 
##        1        2        4        7        9 
## 
## lowest :  0  1  2  3  4, highest: 19 20 21 22 23
## ---------------------------------------------------------------------------
## SOFA_Positive 
##        n  missing distinct 
##  2842521        0        2 
##                           
## Value        FALSE    TRUE
## Frequency  1141836 1700685
## Proportion   0.402   0.598
## ---------------------------------------------------------------------------
## SOFA_Score 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  2842521        0       24    0.979    3.183    3.164        0        0 
##      .25      .50      .75      .90      .95 
##        1        2        5        7        9 
## 
## lowest :  0  1  2  3  4, highest: 19 20 21 22 23
## ---------------------------------------------------------------------------
## SOFA_Positive2 
##        n  missing distinct 
##  2842521        0        2 
##                           
## Value        FALSE    TRUE
## Frequency  1092979 1749542
## Proportion   0.385   0.615
## ---------------------------------------------------------------------------
## GCS_qSOFA 
##        n  missing distinct 
##  2437440   405081        2 
##                           
## Value        FALSE    TRUE
## Frequency  1536220  901220
## Proportion    0.63    0.37
## ---------------------------------------------------------------------------
## BP_qSOFA 
##        n  missing distinct 
##  2643599   198922        2 
##                           
## Value        FALSE    TRUE
## Frequency   961957 1681642
## Proportion   0.364   0.636
## ---------------------------------------------------------------------------
## Resp_qSOFA 
##        n  missing distinct 
##  2707796   134725        2 
##                           
## Value        FALSE    TRUE
## Frequency   760333 1947463
## Proportion   0.281   0.719
## ---------------------------------------------------------------------------
## qSOFA_total 
##        n  missing distinct     Info     Mean      Gmd 
##  2842521        0        4    0.905    1.594    1.016 
##                                           
## Value            0       1       2       3
## Frequency   401017  835190 1123807  482507
## Proportion   0.141   0.294   0.395   0.170
## ---------------------------------------------------------------------------
## qSOFA_Positive 
##        n  missing distinct 
##  2842521        0        2 
##                           
## Value        FALSE    TRUE
## Frequency  1236207 1606314
## Proportion   0.435   0.565
## ---------------------------------------------------------------------------
## temp_SIRS 
##        n  missing distinct 
##  2522673   319848        2 
##                           
## Value        FALSE    TRUE
## Frequency  1798187  724486
## Proportion   0.713   0.287
## ---------------------------------------------------------------------------
## wbc_SIRS 
##        n  missing distinct 
##  2291983   550538        2 
##                           
## Value        FALSE    TRUE
## Frequency  1240013 1051970
## Proportion   0.541   0.459
## ---------------------------------------------------------------------------
## resp_SIRS 
##        n  missing distinct 
##  2723605   118916        2 
##                           
## Value        FALSE    TRUE
## Frequency   591013 2132592
## Proportion   0.217   0.783
## ---------------------------------------------------------------------------
## HR_SIRS 
##        n  missing distinct 
##  2730479   112042        2 
##                           
## Value        FALSE    TRUE
## Frequency   925082 1805397
## Proportion   0.339   0.661
## ---------------------------------------------------------------------------
## SIRS_total 
##        n  missing distinct     Info     Mean      Gmd 
##  2842521        0        5    0.934     2.01    1.247 
##                                              
## Value           0      1      2      3      4
## Frequency  310612 593666 954052 724089 260102
## Proportion  0.109  0.209  0.336  0.255  0.092
## ---------------------------------------------------------------------------
## SIRS_Positive 
##        n  missing distinct 
##  2842521        0        2 
##                           
## Value        FALSE    TRUE
## Frequency   904278 1938243
## Proportion   0.318   0.682
## ---------------------------------------------------------------------------
## StickyMinutes 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##  1422699  1419822      301    0.998    270.4    382.6      -60      -60 
##      .25      .50      .75      .90      .95 
##        5      100      440      890     1110 
## 
## lowest :  -60  -55  -50  -45  -40, highest: 1420 1425 1430 1435 1440
## ---------------------------------------------------------------------------
## FuzzyTotal1 
##        n  missing distinct     Info     Mean      Gmd 
##  2842521        0        3    0.834    1.329   0.7841 
##                                   
## Value            0       1       2
## Frequency   487388  932434 1422699
## Proportion   0.171   0.328   0.501
## ---------------------------------------------------------------------------
## SimultaneousMinutes 
##        n  missing distinct 
##  2842521        0        2 
##                           
## Value        FALSE    TRUE
## Frequency  1523008 1319513
## Proportion   0.536   0.464
## ---------------------------------------------------------------------------
## SepsisFuzzyLogicPositive 
##        n  missing distinct 
##  2842521        0        2 
##                           
## Value        FALSE    TRUE
## Frequency  1523008 1319513
## Proportion   0.536   0.464
## ---------------------------------------------------------------------------
## SepsisFuzzyLogicPositive2 
##        n  missing distinct 
##  2842521        0        2 
##                           
## Value        FALSE    TRUE
## Frequency  1523008 1319513
## Proportion   0.536   0.464
## ---------------------------------------------------------------------------
## hasDiagnosisCodes 
##        n  missing distinct 
##  2842521        0        2 
##                           
## Value        FALSE    TRUE
## Frequency   451180 2391341
## Proportion   0.159   0.841
## ---------------------------------------------------------------------------
## inclusiongroup 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##  2842521        0        2    0.654   912514    0.321   0.4359 
## 
## ---------------------------------------------------------------------------
## 
## Variables with all observations missing:
## 
## [1] hospital_type icu_size
describe(ssd_incl)
## Warning in w * sort(x - mean(x)): longer object length is not a multiple of
## shorter object length
## ssd_incl 
## 
##  295  Variables      912509  Observations
## ---------------------------------------------------------------------------
## patientunitstayid 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0   912509        1  1758473  1107580   244862   371830 
##      .25      .50      .75      .90      .95 
##  1014642  1702955  2585746  3107552  3214507 
## 
## lowest :  141136  141137  141139  141141  141142
## highest: 3353265 3353266 3353268 3353269 3353271
## ---------------------------------------------------------------------------
## exclusion_over18 
##        n  missing distinct     Info     Mean      Gmd 
##   912509        0        1        0        0        0 
##                  
## Value           0
## Frequency  912509
## Proportion      1
## ---------------------------------------------------------------------------
## exclusion_firstadmission 
##        n  missing distinct     Info     Mean      Gmd 
##   912509        0        1        0        0        0 
##                  
## Value           0
## Frequency  912509
## Proportion      1
## ---------------------------------------------------------------------------
## exclusion_yearfilter 
##        n  missing distinct     Info     Mean      Gmd 
##   912509        0        1        0        0        0 
##                  
## Value           0
## Frequency  912509
## Proportion      1
## ---------------------------------------------------------------------------
## exclusion_apacheiva 
##        n  missing distinct     Info     Mean      Gmd 
##   912509        0        1        0        0        0 
##                  
## Value           0
## Frequency  912509
## Proportion      1
## ---------------------------------------------------------------------------
## exclusion_vitalobservations 
##        n  missing distinct     Info     Mean      Gmd 
##   912509        0        1        0        0        0 
##                  
## Value           0
## Frequency  912509
## Proportion      1
## ---------------------------------------------------------------------------
## exclusion_labobservations 
##        n  missing distinct     Info     Mean      Gmd 
##   912509        0        1        0        0        0 
##                  
## Value           0
## Frequency  912509
## Proportion      1
## ---------------------------------------------------------------------------
## exclusion_medobservations 
##        n  missing distinct     Info     Mean      Gmd 
##   912509        0        1        0        0        0 
##                  
## Value           0
## Frequency  912509
## Proportion      1
## ---------------------------------------------------------------------------
## hospitalid 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0      183        1    271.7    127.2       79      122 
##      .25      .50      .75      .90      .95 
##      188      264      358      421      449 
## 
## lowest :  56  58  59  60  61, highest: 447 449 452 458 459
## ---------------------------------------------------------------------------
## gender 
##        n  missing distinct 
##   912509        0        5 
##                                                   
## Value               Female    Male   Other Unknown
## Frequency       53  421748  490533      26     149
## Proportion   0.000   0.462   0.538   0.000   0.000
## ---------------------------------------------------------------------------
## age 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0       73        1    62.94    19.34       29       38 
##      .25      .50      .75      .90      .95 
##       52       65       76       84       88 
## 
## lowest : 18 19 20 21 22, highest: 86 87 88 89 90
## ---------------------------------------------------------------------------
## ethnicity 
##        n  missing distinct 
##   912509        0        7 
## 
## (11604, 0.013), African American (105292, 0.115), Asian (11695, 0.013),
## Caucasian (695367, 0.762), Hispanic (41393, 0.045), Native American (6765,
## 0.007), Other/Unknown (40393, 0.044)
## ---------------------------------------------------------------------------
## hospital_los 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0    57044        1    7.716    7.273    1.035    1.574 
##      .25      .50      .75      .90      .95 
##    2.877    5.299    9.396   15.976   21.925 
## 
## lowest : 3.194444e-02 3.958333e-02 5.208333e-02 8.333333e-02 9.027778e-02
## highest: 9.192007e+02 9.810410e+02 1.099160e+03 1.190723e+03 1.224962e+03
## ---------------------------------------------------------------------------
## hospital_size 
##        n  missing distinct 
##   912509        0        5 
##                                                   
## Value                 <100 100-249 250-500    >500
## Frequency    72678   36772  207117  167113  428829
## Proportion   0.080   0.040   0.227   0.183   0.470
## ---------------------------------------------------------------------------
## hospital_teaching_status 
##        n  missing distinct 
##   912509        0        3 
##                                
## Value                  f      t
## Frequency   37915 598042 276552
## Proportion  0.042  0.655  0.303
## ---------------------------------------------------------------------------
## hospital_region 
##        n  missing distinct 
##   912509        0        5 
##                                                             
## Value                  Midwest Northeast     South      West
## Frequency      55141    383075     73523    283987    116783
## Proportion     0.060     0.420     0.081     0.311     0.128
## ---------------------------------------------------------------------------
## hospital_discharge_disposition 
##        n  missing distinct 
##   912509        0        7 
##                                                                   
## Value              Death          Home   NursingHome         Other
## Frequency          86219        560422         49569         25746
## Proportion         0.094         0.614         0.054         0.028
##                                                     
## Value      OtherExternal OtherHospital           SNF
## Frequency          41679         37692        111182
## Proportion         0.046         0.041         0.122
## ---------------------------------------------------------------------------
## hospital_mortality 
##        n  missing distinct 
##   912509        0        2 
##                         
## Value           0      1
## Frequency  826290  86219
## Proportion  0.906  0.094
## ---------------------------------------------------------------------------
## hospital_mortality_ultimate 
##        n  missing distinct 
##   912509        0        2 
##                         
## Value           0      1
## Frequency  826290  86219
## Proportion  0.906  0.094
## ---------------------------------------------------------------------------
## hospitaladmityear 
##        n  missing distinct     Info     Mean      Gmd 
##   912509        0        7     0.97     2013    1.888 
##                                                            
## Value        2009   2010   2011   2012   2013   2014   2015
## Frequency    1331 112863 122110 149856 167202 178896 180251
## Proportion  0.001  0.124  0.134  0.164  0.183  0.196  0.198
## ---------------------------------------------------------------------------
## hospitaldischargeyear 
##        n  missing distinct 
##   912509        0        6 
##                                                           
## Value        -2010    2011    2012    2013    2014 2015-16
## Frequency   111530  122036  149169  167298  178187  184289
## Proportion   0.122   0.134   0.163   0.183   0.195   0.202
## ---------------------------------------------------------------------------
## icu_los 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0    34183        1    3.078    3.151   0.5257   0.7000 
##      .25      .50      .75      .90      .95 
##   1.0118   1.8444   3.3646   6.6014  10.0431 
## 
## lowest :   0.1666667   0.1673611   0.1680556   0.1687500   0.1694444
## highest: 158.5472222 165.7777778 192.9875000 246.9041667 298.9916667
## ---------------------------------------------------------------------------
## icu_type 
##        n  missing distinct 
##   912509        0       11 
## 
## Cardiac ICU (65472, 0.072), CCU-CTICU (86619, 0.095), CSICU (25733,
## 0.028), CTICU (28922, 0.032), Floating (Universal) License ICU (2596,
## 0.003), Med-Surg ICU (468867, 0.514), MICU (86772, 0.095), Neuro ICU
## (71250, 0.078), SICU (65312, 0.072), Trauma ICU (10946, 0.012), Vent ICU
## (20, 0.000)
## ---------------------------------------------------------------------------
## icu_admit_source 
##        n  missing distinct 
##   912509        0       16 
## 
## (1301, 0.001), Acute Care/Floor (11475, 0.013), Chest Pain Center (3394,
## 0.004), Direct Admit (75096, 0.082), Emergency Department (456475, 0.500),
## Floor (143161, 0.157), ICU (286, 0.000), ICU to SDU (577, 0.001),
## Observation (26, 0.000), Operating Room (124573, 0.137), Other (21,
## 0.000), Other Hospital (22942, 0.025), Other ICU (6129, 0.007), PACU
## (3881, 0.004), Recovery Room (44595, 0.049), Step-Down Unit (SDU) (18577,
## 0.020)
## ---------------------------------------------------------------------------
## icu_disch_location 
##        n  missing distinct 
##   912509        0       18 
## 
## (350, 0.000), Acute Care/Floor (44010, 0.048), Death (61357, 0.067), Floor
## (559247, 0.613), Home (88591, 0.097), ICU (42, 0.000), Nursing Home (1118,
## 0.001), Operating Room (7, 0.000), Other (6359, 0.007), Other External
## (16427, 0.018), Other Hospital (20636, 0.023), Other ICU (6129, 0.007),
## Other ICU (CABG) (1, 0.000), Other Internal (1576, 0.002), Rehabilitation
## (4052, 0.004), Skilled Nursing Facility (8946, 0.010), Step-Down Unit
## (SDU) (33478, 0.037), Telemetry (60183, 0.066)
## ---------------------------------------------------------------------------
## icu_mortality 
##        n  missing distinct 
##   912456       53        2 
##                         
## Value           0      1
## Frequency  851099  61357
## Proportion  0.933  0.067
## ---------------------------------------------------------------------------
## admitsource 
##        n  missing distinct     Info     Mean      Gmd 
##   912509        0        9    0.852    5.857     2.77 
##                                                                          
## Value          -1      1      2      3      4      5      6      7      8
## Frequency    1364 124576  44595   3394 162679   5098  22945  75102 472756
## Proportion  0.001  0.137  0.049  0.004  0.178  0.006  0.025  0.082  0.518
## ---------------------------------------------------------------------------
## dischargelocation 
##        n  missing distinct     Info     Mean      Gmd 
##   912509        0        7     0.72    5.303    1.818 
##                                                            
## Value          -1      4      5      6      7      8      9
## Frequency     350 593099   5756  20636  88591 142720  61357
## Proportion  0.000  0.650  0.006  0.023  0.097  0.156  0.067
## ---------------------------------------------------------------------------
## bedcount 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0       52    0.998    26.08    15.32       10       12 
##      .25      .50      .75      .90      .95 
##       16       22       32       45       62 
## 
## lowest :  2  3  4  5  6, highest: 60 62 68 71 84
## ---------------------------------------------------------------------------
## readmit 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   912509        0        2    0.145    46464  0.05092  0.09665 
## 
## ---------------------------------------------------------------------------
## apacheiva 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0      212        1    55.54    27.83       23       28 
##      .25      .50      .75      .90      .95 
##       37       51       68       90      106 
## 
## lowest :   1   2   3   4   5, highest: 208 209 211 214 230
## ---------------------------------------------------------------------------
## apacheadmissiondx 
##        n  missing distinct 
##   911985      524      400 
## 
## lowest : Abdomen/extremity trauma                                                        Abdomen/face trauma                                                             Abdomen/multiple trauma                                                         Abdomen only trauma                                                             Abdomen/pelvis trauma                                                          
## highest: Vena cava filter insertion                                                      Ventricular Septal Defect (VSD) Repair                                          Ventriculostomy                                                                 Weaning from mechanical ventilation (transfer from other unit or hospital only) Whipple-surgery for pancreatic cancer                                          
## ---------------------------------------------------------------------------
## dialysis 
##        n  missing distinct 
##   912509        0        2 
##                         
## Value           0      1
## Frequency  881875  30634
## Proportion  0.966  0.034
## ---------------------------------------------------------------------------
## aids 
##        n  missing distinct 
##   912509        0        2 
##                         
## Value           0      1
## Frequency  911619    890
## Proportion  0.999  0.001
## ---------------------------------------------------------------------------
## hepaticfailure 
##        n  missing distinct 
##   912509        0        2 
##                         
## Value       FALSE   TRUE
## Frequency  893444  19065
## Proportion  0.979  0.021
## ---------------------------------------------------------------------------
## cirrhosis 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   912509        0        2    0.043    13319   0.0146  0.02877 
## 
## ---------------------------------------------------------------------------
## diabetes 
##        n  missing distinct 
##   912509        0        2 
##                         
## Value           0      1
## Frequency  712693 199816
## Proportion  0.781  0.219
## ---------------------------------------------------------------------------
## immunosuppression 
##        n  missing distinct 
##   912509        0        2 
##                         
## Value           0      1
## Frequency  891128  21381
## Proportion  0.977  0.023
## ---------------------------------------------------------------------------
## leukemia 
##        n  missing distinct 
##   912509        0        2 
##                         
## Value           0      1
## Frequency  905925   6584
## Proportion  0.993  0.007
## ---------------------------------------------------------------------------
## lymphoma 
##        n  missing distinct 
##   912509        0        2 
##                         
## Value           0      1
## Frequency  908895   3614
## Proportion  0.996  0.004
## ---------------------------------------------------------------------------
## metastaticcancer 
##        n  missing distinct 
##   912509        0        2 
##                         
## Value           0      1
## Frequency  895002  17507
## Proportion  0.981  0.019
## ---------------------------------------------------------------------------
## thrombolytics 
##        n  missing distinct 
##   912509        0        2 
##                         
## Value           0      1
## Frequency  895774  16735
## Proportion  0.982  0.018
## ---------------------------------------------------------------------------
## admissionheight 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   889741    22768     1512    0.999    169.5    13.63    152.4    155.0 
##      .25      .50      .75      .90      .95 
##    162.5    170.0    177.8    183.0    187.9 
## 
## lowest :   0.00   0.66   0.88   0.90   0.91, highest: 670.00 700.00 701.00 702.90 712.20
## ---------------------------------------------------------------------------
## admissionweight 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   869001    43508     8190        1    83.83    27.63     50.0     55.7 
##      .25      .50      .75      .90      .95 
##     66.1     80.0     96.6    115.5    130.0 
## 
## lowest :   0.00   0.04   0.09   0.10   0.11, highest: 969.00 970.50 982.00 983.50 987.30
## ---------------------------------------------------------------------------
## chartedweight 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   548040   364469    11291        1    84.12    27.81    49.80    55.54 
##      .25      .50      .75      .90      .95 
##    66.40    80.50    97.40   116.30   130.60 
## 
## lowest :  30.00000  30.02779  30.03000  30.07000  30.07315
## highest: 297.00000 298.00000 298.46354 299.37072 299.90000
## ---------------------------------------------------------------------------
## eyes 
##        n  missing distinct     Info     Mean      Gmd 
##   912509        0        5     0.65    3.428   0.9003 
##                                              
## Value          -1      1      2      3      4
## Frequency    9882  83374  43799 135140 640314
## Proportion  0.011  0.091  0.048  0.148  0.702
## ---------------------------------------------------------------------------
## motor 
##        n  missing distinct     Info     Mean      Gmd 
##   912509        0        7    0.524    5.393    1.045 
##                                                            
## Value          -1      1      2      3      4      5      6
## Frequency    9882  55220   3985   6251  49127  75881 712163
## Proportion  0.011  0.061  0.004  0.007  0.054  0.083  0.780
## ---------------------------------------------------------------------------
## verbal 
##        n  missing distinct     Info     Mean      Gmd 
##   912509        0        6    0.745    3.944    1.538 
##                                                     
## Value          -1      1      2      3      4      5
## Frequency    9882 167720  20933  28514 113272 572188
## Proportion  0.011  0.184  0.023  0.031  0.124  0.627
## ---------------------------------------------------------------------------
## gcs 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0       14    0.809    12.76    3.415        3        7 
##      .25      .50      .75      .90      .95 
##       12       15       15       15       15 
##                                                                          
## Value          -3      3      4      5      6      7      8      9     10
## Frequency    9882  49468   4676   5010  18944  23458  20484  21959  30397
## Proportion  0.011  0.054  0.005  0.005  0.021  0.026  0.022  0.024  0.033
##                                              
## Value          11     12     13     14     15
## Frequency   28152  23840  44576 108048 523615
## Proportion  0.031  0.026  0.049  0.118  0.574
## ---------------------------------------------------------------------------
## unablegcs 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   912509        0        2    0.032     9882  0.01083  0.02142 
## 
## ---------------------------------------------------------------------------
## urine 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0    68282    0.896    998.4     1383     -1.0     -1.0 
##      .25      .50      .75      .90      .95 
##     -1.0    175.7   1609.5   2881.8   3829.8 
## 
## lowest :     -1.0000      0.0000      0.6912      0.7776      0.8640
## highest:  84324.2400  85489.7760  98655.2352 155900.0736 501725.8368
## ---------------------------------------------------------------------------
## pao2_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0     3996    0.565    31.19    53.79       -1       -1 
##      .25      .50      .75      .90      .95 
##       -1       -1       -1      116      173 
## 
## lowest :  -1.0   2.0   4.0   4.5   9.0, highest: 663.8 664.0 677.0 685.4 686.0
## ---------------------------------------------------------------------------
## fio2_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0      197    0.565    13.76     24.1       -1       -1 
##      .25      .50      .75      .90      .95 
##       -1       -1       -1       60      100 
## 
## lowest :  -1.0  21.0  22.0  23.0  23.5, highest:  99.6  99.7  99.8  99.9 100.0
## ---------------------------------------------------------------------------
## pao2fio2_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0    14034    0.565    57.48    96.84     -1.0     -1.0 
##      .25      .50      .75      .90      .95 
##     -1.0     -1.0     -1.0    252.4    342.5 
## 
## lowest :   -1.00000    9.52381   10.00000   11.00000   12.00000
## highest: 2365.21739 2500.00000 2704.76190 2719.04762 2804.76190
## ---------------------------------------------------------------------------
## temperature_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0      536    0.997    35.15    3.215    33.90    35.50 
##      .25      .50      .75      .90      .95 
##    36.10    36.40    36.70    37.05    37.33 
## 
## lowest : -1.00 20.00 20.10 20.20 20.30, highest: 42.66 42.70 42.80 42.90 43.00
## ---------------------------------------------------------------------------
## respiratoryrate_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0      134    0.999    24.88    17.09        5        7 
##      .25      .50      .75      .90      .95 
##       10       27       35       45       52 
## 
## lowest :  4.0  5.0  6.0  6.6  6.7, highest: 57.0 58.0 59.0 59.1 60.0
## ---------------------------------------------------------------------------
## heartrate_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0      201        1    100.1    34.69       48       53 
##      .25      .50      .75      .90      .95 
##       87      104      120      136      146 
## 
## lowest :  20  21  22  23  24, highest: 216 217 218 219 220
## ---------------------------------------------------------------------------
## mbp_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0      161        1    85.71    45.43       42       45 
##      .25      .50      .75      .90      .95 
##       53       64      123      146      163 
## 
## lowest :  40  41  42  43  44, highest: 196 197 198 199 200
## ---------------------------------------------------------------------------
## albumin_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   363837   548672       63    0.998     2.92   0.7948      1.7      2.0 
##      .25      .50      .75      .90      .95 
##      2.4      2.9      3.4      3.8      4.0 
## 
## lowest : 1.0 1.1 1.2 1.3 1.4, highest: 6.3 6.7 6.9 7.0 8.2
## ---------------------------------------------------------------------------
## bilirubin_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0      966    0.745  -0.1945    1.194     -1.0     -1.0 
##      .25      .50      .75      .90      .95 
##     -1.0     -1.0      0.5      1.0      1.7 
## 
## lowest : -1.00  0.05  0.09  0.10  0.11, highest: 60.30 61.50 63.10 64.00 72.40
## ---------------------------------------------------------------------------
## bun_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0      944    0.992    21.28    22.29       -1       -1 
##      .25      .50      .75      .90      .95 
##        8       16       28       49       66 
## 
## lowest :  -1.0   1.0   2.0   2.3   2.5, highest: 251.0 252.0 253.0 254.0 255.0
## ---------------------------------------------------------------------------
## creatinine_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0     2398    0.993     1.05    1.628    -1.00    -1.00 
##      .25      .50      .75      .90      .95 
##     0.53     0.84     1.38     2.57     4.08 
## 
## lowest : -1.00  0.10  0.11  0.12  0.13, highest: 24.89 24.91 24.94 24.95 25.00
## ---------------------------------------------------------------------------
## glucose_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0     1384    0.999    148.1    110.2       -1       -1 
##      .25      .50      .75      .90      .95 
##       89      121      194      275      342 
## 
## lowest :   -1.0    1.0    1.1    1.3    1.5, highest: 2356.0 2357.0 2796.0 2810.0 2954.0
## ---------------------------------------------------------------------------
## hematocrit_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0      612    0.992    25.91     15.7     -1.0     -1.0 
##      .25      .50      .75      .90      .95 
##     22.3     30.3     36.1     40.4     42.8 
## 
## lowest : -1.0  5.0  5.1  5.9  6.0, highest: 70.2 70.8 71.0 72.7 78.0
## ---------------------------------------------------------------------------
## sodium_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0      253    0.991    112.2    45.42       -1       -1 
##      .25      .50      .75      .90      .95 
##      131      137      140      142      145 
## 
## lowest :  -1  88  90  91  95, highest: 190 192 194 196 198
## ---------------------------------------------------------------------------
## paco2_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0     1164    0.565    9.506    16.71       -1       -1 
##      .25      .50      .75      .90      .95 
##       -1       -1       -1       42       49 
## 
## lowest :  -1.0   3.1   6.9   7.0   7.3, highest: 147.7 147.8 148.0 148.8 150.0
## ---------------------------------------------------------------------------
## ph_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0      967    0.565    1.025    3.076   -1.000   -1.000 
##      .25      .50      .75      .90      .95 
##   -1.000   -1.000   -1.000    7.390    7.435 
## 
## -1 (691448, 0.758), 6.3 (1, 0.000), 6.5 (5, 0.000), 6.6 (11, 0.000), 6.7
## (46, 0.000), 6.8 (217, 0.000), 6.9 (690, 0.001), 7 (1738, 0.002), 7.1
## (4958, 0.005), 7.2 (16712, 0.018), 7.3 (62997, 0.069), 7.4 (96463, 0.106),
## 7.5 (33188, 0.036), 7.6 (3721, 0.004), 7.7 (291, 0.000), 7.8 (19, 0.000),
## 7.9 (2, 0.000), 8 (1, 0.000), 8.6 (1, 0.000)
## ---------------------------------------------------------------------------
## intubated_apache 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   912509        0        2    0.393   141662   0.1552   0.2623 
## 
## ---------------------------------------------------------------------------
## wbc_apache 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0     5611    0.988    9.145    8.983    -1.00    -1.00 
##      .25      .50      .75      .90      .95 
##     3.60     8.50    13.40    18.90    23.28 
## 
## lowest :  -1.00   0.01   0.02   0.03   0.04, highest: 196.80 197.00 197.70 199.00 199.20
## ---------------------------------------------------------------------------
## oobintubday1_apache 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   912509        0        2    0.574   235413    0.258   0.3829 
## 
## ---------------------------------------------------------------------------
## oobventday1_apache 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   912509        0        2    0.657   295615    0.324    0.438 
## 
## ---------------------------------------------------------------------------
## ventday1_apache 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   912509        0        2    0.547   218677   0.2396   0.3644 
## 
## ---------------------------------------------------------------------------
## physicianspeciality 
##        n  missing distinct 
##   912509        0       49 
## 
## lowest : allergy/immunology           anesthesiology               anesthesiology/CCM           cardiology                   critical care medicine (CCM)
## highest: surgery-transplant           surgery-trauma               surgery-vascular             unknown                      urology                     
## ---------------------------------------------------------------------------
## acutephysiologyscore 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0      198        1    43.81    25.13       16       20 
##      .25      .50      .75      .90      .95 
##       27       38       54       76       92 
## 
## lowest :   0   1   2   3   4, highest: 194 195 198 200 206
## ---------------------------------------------------------------------------
## apachescore 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0      212        1    55.54    27.83       23       28 
##      .25      .50      .75      .90      .95 
##       37       51       68       90      106 
## 
## lowest :   1   2   3   4   5, highest: 208 209 211 214 230
## ---------------------------------------------------------------------------
## predictedicumortality 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0   889923        1  0.05459   0.1406 0.002357 0.004004 
##      .25      .50      .75      .90      .95 
## 0.009022 0.022689 0.064605 0.194698 0.368231 
## 
## lowest : -1.000000e+00  7.088864e-10  7.633918e-10  7.749529e-10  7.966238e-10
## highest:  9.831448e-01  9.833071e-01  9.851197e-01  9.859533e-01  9.951461e-01
## ---------------------------------------------------------------------------
## predictediculos 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0   889227        1    3.851    2.513    1.135    1.555 
##      .25      .50      .75      .90      .95 
##    2.184    3.319    5.192    7.244    8.309 
## 
## lowest : -1.0000000000  0.0005581499  0.0010462120  0.0033882155  0.0036456098
## highest: 15.2146312944 15.3433721860 15.3576234639 16.0262378684 19.9075117024
## ---------------------------------------------------------------------------
## predictedhospitalmortality 
##         n   missing  distinct      Info      Mean       Gmd       .05 
##    912509         0    846588         1   0.04401    0.2669 -1.000000 
##       .10       .25       .50       .75       .90       .95 
##  0.005689  0.017526  0.046130  0.122479  0.304494  0.494634 
## 
## lowest : -1.0000000000  0.0003451466  0.0003794773  0.0003825366  0.0004188721
## highest:  0.9930928093  0.9930994412  0.9932010502  0.9979823377  0.9981384119
## ---------------------------------------------------------------------------
## predictedhospitallos 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0   846540        1    9.384    5.737   -1.000    3.711 
##      .25      .50      .75      .90      .95 
##    6.308    9.053   12.161   15.609   18.401 
## 
## lowest : -1.000000e+00  9.883428e-04  3.367056e-03  9.694190e-03  1.226688e-02
## highest:  9.934482e+01  1.021803e+02  1.039875e+02  1.066029e+02  1.469374e+02
## ---------------------------------------------------------------------------
## preopmi 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   912509        0        2    0.009     2663 0.002918  0.00582 
## 
## ---------------------------------------------------------------------------
## preopcardiaccath 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   912509        0        2    0.023     6932 0.007597  0.01508 
## 
## ---------------------------------------------------------------------------
## ptcawithin24h 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   912509        0        2    0.188    61222  0.06709   0.1252 
## 
## ---------------------------------------------------------------------------
## graftcount 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0       10     0.04    2.999  0.03646        3        3 
##      .25      .50      .75      .90      .95 
##        3        3        3        3        3 
##                                                                          
## Value           1      2      3      4      5      6      7      8      9
## Frequency    2419   3927 900090   4513   1288    227     34      9      1
## Proportion  0.003  0.004  0.986  0.005  0.001  0.000  0.000  0.000  0.000
##                  
## Value          10
## Frequency       1
## Proportion  0.000
## ---------------------------------------------------------------------------
## mbp_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   911199     1310      152        1    57.02    18.97       26       35 
##      .25      .50      .75      .90      .95 
##       47       58       68       78       84 
## 
## lowest :   1   2   3   4   5, highest: 157 162 165 292 296
## ---------------------------------------------------------------------------
## sbp_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   911192     1317      172        1    58.88    18.98       29       37 
##      .25      .50      .75      .90      .95 
##       49       59       70       80       86 
## 
## lowest :   1   2   3   4   5, highest: 174 175 176 177 179
## ---------------------------------------------------------------------------
## temperature_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##    74236   838273     1881        1    40.71    14.61     23.9     30.7 
##      .25      .50      .75      .90      .95 
##     34.8     36.1     36.9     80.3     97.0 
## 
## lowest :   0.05   0.10   0.20   0.25   0.30, highest: 105.20 105.60 106.00 108.40 109.70
## ---------------------------------------------------------------------------
## temperature_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##    74236   838273      901    0.999    44.57    13.26    36.10    36.72 
##      .25      .50      .75      .90      .95 
##    37.30    37.80    38.60    97.80   100.10 
## 
## lowest :   0.10   0.40   3.20   4.35   4.40, highest: 112.15 112.50 112.70 112.90 151.00
## ---------------------------------------------------------------------------
## heartrate_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   911360     1149      263        1    107.9    24.68       76       81 
##      .25      .50      .75      .90      .95 
##       92      106      121      137      147 
## 
## lowest :  29  30  31  32  33, highest: 296 297 298 299 300
## ---------------------------------------------------------------------------
## respiratoryrate_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   864221    48288      208    0.998    33.09    13.66       20       22 
##      .25      .50      .75      .90      .95 
##       24       29       36       47       57 
##                                                                          
## Value           0    500  13500  19000  27000  37000  51000  57500  58500
## Frequency  864212      1      1      1      1      1      1      1      1
## Proportion      1      0      0      0      0      0      0      0      0
##                  
## Value       63000
## Frequency       1
## Proportion      0
## ---------------------------------------------------------------------------
## heartrate_charted_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   829506    83003      272        1    102.4    24.91       70       76 
##      .25      .50      .75      .90      .95 
##       87      100      116      132      142 
## 
## lowest :   5   7  14  15  18, highest: 320 347 360 361 379
## ---------------------------------------------------------------------------
## respiratoryrate_charted_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   834367    78142       79    0.998    27.72    9.502       17       19 
##      .25      .50      .75      .90      .95 
##       22       26       31       39       46 
## 
## lowest :  1  2  3  4  5, highest: 75 76 77 78 79
## ---------------------------------------------------------------------------
## o2saturation_charted_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   792701   119808      101    0.995    91.37    7.124       79       85 
##      .25      .50      .75      .90      .95 
##       90       93       96       98       99 
## 
## lowest :   1   2   3   4   5, highest:  96  97  98  99 100
## ---------------------------------------------------------------------------
## nibp_systolic_charted_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   808844   103665      268        1    97.44    23.54       65       72 
##      .25      .50      .75      .90      .95 
##       84       96      110      124      134 
## 
## lowest :   1   2   3   4   5, highest: 246 248 256 261 269
## ---------------------------------------------------------------------------
## nibp_diastolic_charted_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   809166   103343      195    0.999    49.74    15.58       27       33 
##      .25      .50      .75      .90      .95 
##       41       49       58       67       74 
## 
## lowest :   1   2   3   4   5, highest: 185 187 188 190 226
## ---------------------------------------------------------------------------
## nibp_mean_charted_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   767729   144780      195        1    64.52     17.6       40       46 
##      .25      .50      .75      .90      .95 
##       54       63       74       85       92 
## 
## lowest :   0.13   0.61   0.74   0.87   1.00, highest: 194.00 195.00 196.00 200.00 232.00
## ---------------------------------------------------------------------------
## ibp_systolic_charted_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   197536   714973      294        1    95.91    27.39       58       69 
##      .25      .50      .75      .90      .95 
##       82       94      110      128      139 
## 
## lowest :   1   2   3   4   5, highest: 319 334 338 348 390
## ---------------------------------------------------------------------------
## ibp_diastolic_charted_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   197464   715045      215    0.999     48.2    14.36       29       34 
##      .25      .50      .75      .90      .95 
##       40       47       55       64       70 
## 
## lowest :   1   2   3   4   5, highest: 316 333 334 348 390
## ---------------------------------------------------------------------------
## ibp_mean_charted_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   214633   697876      388    0.999    64.33    18.53       38       47 
##      .25      .50      .75      .90      .95 
##       55       63       73       84       92 
## 
## lowest :   1   2   3   4   5, highest: 357 359 360 364 390
## ---------------------------------------------------------------------------
## mbp_charted_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   814231    98278      265        1    63.45    17.71       39       45 
##      .25      .50      .75      .90      .95 
##       54       63       73       84       91 
## 
## lowest :   0.13   0.61   0.74   0.87   1.00, highest: 194.00 196.00 200.00 232.00 287.00
## ---------------------------------------------------------------------------
## sbp_charted_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   822995    89514      271        1     95.7    23.86       62       71 
##      .25      .50      .75      .90      .95 
##       82       95      109      123      132 
## 
## lowest :   1   2   3   4   5, highest: 240 244 246 248 256
## ---------------------------------------------------------------------------
## temperature_charted_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   893018    19491      684    0.996    36.27   0.7088     35.1     35.6 
##      .25      .50      .75      .90      .95 
##     36.1     36.4     36.7     36.9     37.1 
## 
## lowest : 20.10 20.20 20.22 20.30 20.40, highest: 42.10 42.70 45.30 46.20 48.20
## ---------------------------------------------------------------------------
## temperature_charted_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   893018    19491      577    0.997    37.29   0.7655    36.40    36.60 
##      .25      .50      .75      .90      .95 
##    36.90    37.16    37.60    38.20    38.70 
## 
## lowest : 21.70 27.90 28.10 28.80 28.88, highest: 48.33 48.60 48.70 48.80 48.90
## ---------------------------------------------------------------------------
## gcs_charted_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   619639   292870       14    0.878     12.4    3.671        3        6 
##      .25      .50      .75      .90      .95 
##       10       14       15       15       15 
##                                                                          
## Value         3.0    4.0    5.0    6.0    7.0    8.0    9.0   10.0   11.0
## Frequency   43551   4164   3990  17521  21691  19150  18104  27352  21557
## Proportion  0.070  0.007  0.006  0.028  0.035  0.031  0.029  0.044  0.035
##                                              
## Value        12.0   13.0   14.0   14.5   15.0
## Frequency   15589  33320  89442      1 304207
## Proportion  0.025  0.054  0.144  0.000  0.491
## ---------------------------------------------------------------------------
## bilirubin_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   377882   534627     1016    0.994    1.195    1.291      0.2      0.3 
##      .25      .50      .75      .90      .95 
##      0.4      0.7      1.1      2.1      3.5 
## 
## lowest :  0.00  0.05  0.09  0.10  0.11, highest: 61.50 63.10 64.00 67.90 72.40
## ---------------------------------------------------------------------------
## creatinine_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   823925    88584     2539        1    1.547    1.279     0.51     0.60 
##      .25      .50      .75      .90      .95 
##     0.76     1.00     1.57     2.95     4.60 
## 
## lowest :   0.00   0.06   0.07   0.10   0.11, highest:  48.59  50.70  51.70  56.00 107.00
## ---------------------------------------------------------------------------
## lactate_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   214669   697840     1105    0.999    2.107    1.778      0.6      0.7 
##      .25      .50      .75      .90      .95 
##      1.0      1.5      2.3      3.8      5.9 
## 
## lowest :  0.00  0.10  0.11  0.20  0.24, highest: 36.90 38.50 38.90 39.73 40.90
## ---------------------------------------------------------------------------
## lactate_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   214669   697840     1550    0.999    2.909    2.698      0.7      0.8 
##      .25      .50      .75      .90      .95 
##      1.2      1.8      3.2      6.1      9.2 
##                                                                          
## Value           0      5     10     15     20     25     30     35     40
## Frequency  141487  57611   9968   3630   1381    419    128     31      8
## Proportion  0.659  0.268  0.046  0.017  0.006  0.002  0.001  0.000  0.000
##                         
## Value          45    510
## Frequency       5      1
## Proportion  0.000  0.000
## ---------------------------------------------------------------------------
## pao2_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   346221   566288     3508        1    101.6    57.56       44       54 
##      .25      .50      .75      .90      .95 
##       66       83      115      166      216 
##                                                                          
## Value           0    100    200    300    400    500    600    700   1000
## Frequency   27177 273711  33100   7093   3447   1448    233      7      2
## Proportion  0.078  0.791  0.096  0.020  0.010  0.004  0.001  0.000  0.000
##                                
## Value        1100   2800  11800
## Frequency       1      1      1
## Proportion  0.000  0.000  0.000
## ---------------------------------------------------------------------------
## pao2_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   346221   566288     4902        1    165.3      113     61.9     69.2 
##      .25      .50      .75      .90      .95 
##     87.0    125.0    206.0    335.0    413.0 
## 
## 0 (5543, 0.016), 100 (202735, 0.586), 200 (75124, 0.217), 300 (31943,
## 0.092), 400 (19609, 0.057), 500 (9384, 0.027), 600 (1778, 0.005), 700 (85,
## 0.000), 800 (8, 0.000), 900 (1, 0.000), 1000 (2, 0.000), 1100 (2, 0.000),
## 1200 (1, 0.000), 1700 (1, 0.000), 2100 (1, 0.000), 2800 (1, 0.000), 3600
## (1, 0.000), 5400 (1, 0.000), 11800 (1, 0.000)
## ---------------------------------------------------------------------------
## paco2_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   346097   566412     1146        1    38.87    12.46     23.3     26.7 
##      .25      .50      .75      .90      .95 
##     31.7     37.0     43.7     53.0     61.2 
##                                                                          
## Value        -100      0     50    100    150    200    250    300    400
## Frequency       1  23031 317541   5413     90      9      2      1      2
## Proportion  0.000  0.067  0.917  0.016  0.000  0.000  0.000  0.000  0.000
##                                
## Value         450   3650   4550
## Frequency       5      1      1
## Proportion  0.000  0.000  0.000
## ---------------------------------------------------------------------------
## paco2_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   346097   566412     1487        1    46.07    16.28     27.4     31.0 
##      .25      .50      .75      .90      .95 
##     36.0     43.0     51.0     65.0     78.0 
##                                                                          
## Value           0    100    200    300    400    500    600    700   3600
## Frequency  253905  91948    216      7     10      5      2      1      1
## Proportion  0.734  0.266  0.001  0.000  0.000  0.000  0.000  0.000  0.000
##                         
## Value        4600   7500
## Frequency       1      1
## Proportion  0.000  0.000
## ---------------------------------------------------------------------------
## platelet_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   791142   121367     1099        1    197.2    99.31       68       94 
##      .25      .50      .75      .90      .95 
##      137      186      243      308      361 
## 
## lowest :    0.00    1.00    1.05    2.00    3.00
## highest: 2113.00 2221.00 2353.00 2371.00 2449.00
## ---------------------------------------------------------------------------
## inr_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   364715   547794     1085    0.993    1.614    0.815     1.00     1.00 
##      .25      .50      .75      .90      .95 
##     1.10     1.30     1.60     2.50     3.45 
## 
## lowest :   0.00   0.50   0.60   0.66   0.70, highest:  24.50  27.20  32.10  38.10 130.00
## ---------------------------------------------------------------------------
## wbc_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   794580   117929     5349        1    11.29    6.364      4.3      5.4 
##      .25      .50      .75      .90      .95 
##      7.3      9.9     13.5     18.1     22.1 
## 
## lowest :   0.00   0.01   0.02   0.03   0.04, highest: 613.40 774.00 776.40 778.40 813.90
## ---------------------------------------------------------------------------
## wbc_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   794580   117929     5938        1    12.52    7.252      4.7      5.8 
##      .25      .50      .75      .90      .95 
##      7.9     10.9     15.0     20.5     25.0 
## 
## lowest :   0.00   0.01   0.02   0.03   0.04, highest: 657.46 774.00 776.40 778.40 813.90
## ---------------------------------------------------------------------------
## ptt_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   266885   645624     2321        1    44.02    24.64     24.0     25.4 
##      .25      .50      .75      .90      .95 
##     28.5     33.9     45.1     77.1    107.0 
## 
## lowest :  12.2  14.2  14.5  15.0  15.1, highest: 296.3 296.9 298.5 300.0 380.0
## ---------------------------------------------------------------------------
## bands_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##    76228   836281      737    0.997    12.54    13.61        1        1 
##      .25      .50      .75      .90      .95 
##        3        8       17       31       40 
##                                   
## Value          0    50   100  6400
## Frequency  65175 10762   290     1
## Proportion 0.855 0.141 0.004 0.000
## ---------------------------------------------------------------------------
## ph_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   335524   576985     1028        1    7.375   0.2206    7.110    7.180 
##      .25      .50      .75      .90      .95 
##    7.271    7.341    7.401    7.450    7.480 
##                                              
## Value           0    100    700   7200   7300
## Frequency  335518      2      2      1      1
## Proportion      1      0      0      0      0
## ---------------------------------------------------------------------------
## basedeficit_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##    59048   853461      429    0.999    6.095    5.381      0.7      1.0 
##      .25      .50      .75      .90      .95 
##      2.5      4.9      8.0     13.0     17.0 
## 
## lowest : -30.0 -24.4 -23.9 -21.0 -18.2, highest:  34.3  34.4  34.7  35.0  36.6
## ---------------------------------------------------------------------------
## basedeficit_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##    59048   853461      429    0.999    6.095    5.381      0.7      1.0 
##      .25      .50      .75      .90      .95 
##      2.5      4.9      8.0     13.0     17.0 
## 
## lowest : -30.0 -24.4 -23.9 -21.0 -18.2, highest:  34.3  34.4  34.7  35.0  36.6
## ---------------------------------------------------------------------------
## ast_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   383902   528607     6246        1    178.8    291.4       12       15 
##      .25      .50      .75      .90      .95 
##       20       32       69      198      467 
## 
## lowest :      0      1      2      3      4, highest:  43957  46817  54043  56238 200111
## ---------------------------------------------------------------------------
## alt_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   378856   533653     4501        1      109    166.2       10       12 
##      .25      .50      .75      .90      .95 
##       17       28       51      128      299 
## 
## lowest :     0     1     2     3     4, highest: 16185 16738 17091 18200 18978
## ---------------------------------------------------------------------------
## alp_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   371564   540945     1430        1    101.2    68.55       39       46 
##      .25      .50      .75      .90      .95 
##       59       78      110      165      228 
## 
## lowest :  -154.0     1.0     2.0     3.0     3.7
## highest:  4254.0  4956.0  7443.0  8146.0 10001.0
## ---------------------------------------------------------------------------
## penicilin 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   903501     9008        2    0.016     4748 0.005255  0.01046 
## 
## ---------------------------------------------------------------------------
## penicilin_anti_staph 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   903501     9008        2    0.003     1015 0.001123 0.002244 
## 
## ---------------------------------------------------------------------------
## penicilin_anti_pseudo 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   903501     9008        2    0.352   122743   0.1359   0.2348 
## 
## ---------------------------------------------------------------------------
## augmentin_unasyn 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   903501     9008        2    0.036    10897  0.01206  0.02383 
## 
## ---------------------------------------------------------------------------
## cephalosporin_1st_gen 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   903501     9008        2    0.132    41557    0.046  0.08776 
## 
## ---------------------------------------------------------------------------
## cephalosporin_2nd_gen 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   903501     9008        2    0.077    23685  0.02621  0.05106 
## 
## ---------------------------------------------------------------------------
## cephalosporin_3rd_gen 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   903501     9008        2    0.209    68100  0.07537   0.1394 
## 
## ---------------------------------------------------------------------------
## cephalosporin_4th_5th_gen 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   903501     9008        2    0.094    29182   0.0323  0.06251 
## 
## ---------------------------------------------------------------------------
## carbapenems 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   903501     9008        2    0.086    26826  0.02969  0.05762 
## 
## ---------------------------------------------------------------------------
## monobactam 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   903501     9008        2    0.034    10318  0.01142  0.02258 
## 
## ---------------------------------------------------------------------------
## fq 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   903501     9008        2    0.253    84164  0.09315    0.169 
## 
## ---------------------------------------------------------------------------
## vancomycin 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   903501     9008        2    0.464   173027   0.1915   0.3097 
## 
## ---------------------------------------------------------------------------
## amg 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   903501     9008        2    0.044    13504  0.01495  0.02945 
## 
## ---------------------------------------------------------------------------
## polymixins 
##         n   missing  distinct      Info       Sum      Mean       Gmd 
##    903501      9008         2     0.003       769 0.0008511  0.001701 
## 
## ---------------------------------------------------------------------------
## linezolid 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   903501     9008        2    0.024     7163 0.007928  0.01573 
## 
## ---------------------------------------------------------------------------
## dapto 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   903501     9008        2     0.01     3080 0.003409 0.006795 
## 
## ---------------------------------------------------------------------------
## clinda 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   903501     9008        2    0.051    15696  0.01737  0.03414 
## 
## ---------------------------------------------------------------------------
## doxycyclin 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   903501     9008        2    0.023     7049 0.007802  0.01548 
## 
## ---------------------------------------------------------------------------
## macrolides 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   903501     9008        2    0.115    36029  0.03988  0.07657 
## 
## ---------------------------------------------------------------------------
## sulfa 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   903501     9008        2    0.025     7480 0.008279  0.01642 
## 
## ---------------------------------------------------------------------------
## metronidazole 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   903501     9008        2    0.132    41517  0.04595  0.08768 
## 
## ---------------------------------------------------------------------------
## nitrofurantoin 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   903501     9008        2    0.004     1250 0.001384 0.002763 
## 
## ---------------------------------------------------------------------------
## tigecycline 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   903501     9008        2    0.007     2127 0.002354 0.004697 
## 
## ---------------------------------------------------------------------------
## ceftriaxone 
##        n  missing distinct     Info     Mean      Gmd 
##   903501     9008        1        0        0        0 
##                  
## Value           0
## Frequency  903501
## Proportion      1
## ---------------------------------------------------------------------------
## cefotaxime 
##        n  missing distinct     Info     Mean      Gmd 
##   903501     9008        1        0        0        0 
##                  
## Value           0
## Frequency  903501
## Proportion      1
## ---------------------------------------------------------------------------
## ampicillin_sulbactam 
##        n  missing distinct     Info     Mean      Gmd 
##   903501     9008        1        0        0        0 
##                  
## Value           0
## Frequency  903501
## Proportion      1
## ---------------------------------------------------------------------------
## levofloxacin 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   903501     9008        2    0.033     9936    0.011  0.02175 
## 
## ---------------------------------------------------------------------------
## moxifloxacin 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   903501     9008        2    0.004     1097 0.001214 0.002425 
## 
## ---------------------------------------------------------------------------
## piperacillin_tazobactam 
##        n  missing distinct     Info     Mean      Gmd 
##   903501     9008        1        0        0        0 
##                  
## Value           0
## Frequency  903501
## Proportion      1
## ---------------------------------------------------------------------------
## cefepim 
##        n  missing distinct     Info     Mean      Gmd 
##   903501     9008        1        0        0        0 
##                  
## Value           0
## Frequency  903501
## Proportion      1
## ---------------------------------------------------------------------------
## meropenem 
##        n  missing distinct     Info     Mean      Gmd 
##   903501     9008        1        0        0        0 
##                  
## Value           0
## Frequency  903501
## Proportion      1
## ---------------------------------------------------------------------------
## imipenem 
##        n  missing distinct     Info     Mean      Gmd 
##   903501     9008        1        0        0        0 
##                  
## Value           0
## Frequency  903501
## Proportion      1
## ---------------------------------------------------------------------------
## doripenem 
##        n  missing distinct     Info     Mean      Gmd 
##   903501     9008        1        0        0        0 
##                  
## Value           0
## Frequency  903501
## Proportion      1
## ---------------------------------------------------------------------------
## gentamicin 
##         n   missing  distinct      Info       Sum      Mean       Gmd 
##    903501      9008         2         0        22 2.435e-05  4.87e-05 
## 
## ---------------------------------------------------------------------------
## tobramycin 
##         n   missing  distinct      Info       Sum      Mean       Gmd 
##    903501      9008         2     0.001       172 0.0001904 0.0003807 
## 
## ---------------------------------------------------------------------------
## amikacin 
##        n  missing distinct     Info     Mean      Gmd 
##   903501     9008        1        0        0        0 
##                  
## Value           0
## Frequency  903501
## Proportion      1
## ---------------------------------------------------------------------------
## dopamine_infusion 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   912509        0        2    0.076    23820   0.0261  0.05084 
## 
## ---------------------------------------------------------------------------
## epinephrine_infusion 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   912509        0        2    0.032     9938  0.01089  0.02154 
## 
## ---------------------------------------------------------------------------
## norepinephrine_infusion 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   912509        0        2    0.234    77890  0.08536   0.1561 
## 
## ---------------------------------------------------------------------------
## phenylephrine_infusion 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   912509        0        2    0.083    26080  0.02858  0.05553 
## 
## ---------------------------------------------------------------------------
## vasopressin_infusion 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   347509   565000        2    0.132    16059  0.04621  0.08815 
## 
## ---------------------------------------------------------------------------
## milrinone_infusion 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   912509        0        2    0.019     5782 0.006336  0.01259 
## 
## ---------------------------------------------------------------------------
## heparin_infusion 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   347509   565000        2    0.303    39684   0.1142   0.2023 
## 
## ---------------------------------------------------------------------------
## dopamine_medication 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   912509        0        2    0.142    45389  0.04974  0.09453 
## 
## ---------------------------------------------------------------------------
## epinephrine_medication 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   912509        0        2    0.101    31830  0.03488  0.06733 
## 
## ---------------------------------------------------------------------------
## norepinephrine_medication 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   912509        0        2    0.314   108457   0.1189   0.2095 
## 
## ---------------------------------------------------------------------------
## phenylephrine_medication 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   912509        0        2    0.165    53473   0.0586   0.1103 
## 
## ---------------------------------------------------------------------------
## vasopressin_medication 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   903501     9008        2    0.097    30270   0.0335  0.06476 
## 
## ---------------------------------------------------------------------------
## milrinone_medication 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   912509        0        2     0.03     9190  0.01007  0.01994 
## 
## ---------------------------------------------------------------------------
## heparin_medication 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   903501     9008        2    0.581   237112   0.2624   0.3871 
## 
## ---------------------------------------------------------------------------
## sepsis 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   912509        0        2    0.318   109798   0.1203   0.2117 
## 
## ---------------------------------------------------------------------------
## sepsis_priority 
##        n  missing distinct     Info     Mean      Gmd 
##   912509        0        4    0.319   0.1965   0.3579 
##                                       
## Value           0      1      2      3
## Frequency  802711  66404  17251  26143
## Proportion  0.880  0.073  0.019  0.029
## ---------------------------------------------------------------------------
## infection 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   912509        0        2    0.597   250420   0.2744   0.3982 
## 
## ---------------------------------------------------------------------------
## infection_priority 
##        n  missing distinct     Info     Mean      Gmd 
##   912509        0        4    0.615    0.495   0.7861 
##                                       
## Value           0      1      2      3
## Frequency  662089 118863  61871  69686
## Proportion  0.726  0.130  0.068  0.076
## ---------------------------------------------------------------------------
## aidshiv 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   912509        0        2     0.01     2961 0.003245 0.006469 
## 
## ---------------------------------------------------------------------------
## aidshiv_priority 
##        n  missing distinct     Info     Mean      Gmd 
##   912509        0        4     0.01 0.007939  0.01583 
##                                       
## Value           0      1      2      3
## Frequency  909548     48   1543   1370
## Proportion  0.997  0.000  0.002  0.002
## ---------------------------------------------------------------------------
## organfailure 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   912509        0        2    0.725   372946   0.4087   0.4833 
## 
## ---------------------------------------------------------------------------
## organfailure_priority 
##        n  missing distinct     Info     Mean      Gmd 
##   912509        0        4    0.785   0.7615    1.051 
##                                       
## Value           0      1      2      3
## Frequency  539563 159065 105867 108014
## Proportion  0.591  0.174  0.116  0.118
## ---------------------------------------------------------------------------
## altered_mental_status 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   912509        0        2    0.261    87685  0.09609   0.1737 
## 
## ---------------------------------------------------------------------------
## altered_mental_status_priority 
##        n  missing distinct     Info     Mean      Gmd 
##   912509        0        4    0.261   0.2117   0.3901 
##                                       
## Value           0      1      2      3
## Frequency  824824  16981  35888  34816
## Proportion  0.904  0.019  0.039  0.038
## ---------------------------------------------------------------------------
## infection_apache 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   912509        0        2    0.416   151832   0.1664   0.2774 
## 
## ---------------------------------------------------------------------------
## organfailure_apache 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   912509        0        2    0.176    57210   0.0627   0.1175 
## 
## ---------------------------------------------------------------------------
## prompt_inflam 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   380100   532409        2    0.568    96341   0.2535   0.3784 
## 
## ---------------------------------------------------------------------------
## prompt_severe_sepsis 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   380100   532409        2    0.254    35505  0.09341   0.1694 
## 
## ---------------------------------------------------------------------------
## prompt_sepsis 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   380100   532409        2     0.12    15907  0.04185   0.0802 
## 
## ---------------------------------------------------------------------------
## prompt_inflam_with_org_dys 
##         n   missing  distinct      Info       Sum      Mean       Gmd 
##    380100    532409         2         0         4 1.052e-05 2.105e-05 
## 
## ---------------------------------------------------------------------------
## prompt_clinical_respone_req 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   380100   532409        2    0.004   379551   0.9986 0.002885 
## 
## ---------------------------------------------------------------------------
## sofa_respiration 
##        n  missing distinct     Info     Mean      Gmd 
##   912509        0        5    0.386   0.3666   0.6443 
##                                              
## Value           0      1      2      3      4
## Frequency  775552  17318  59473  42413  17753
## Proportion  0.850  0.019  0.065  0.046  0.019
## ---------------------------------------------------------------------------
## sofa_coagulation 
##        n  missing distinct     Info     Mean      Gmd 
##   912509        0        5    0.603   0.3963   0.6278 
##                                              
## Value           0      1      2      3      4
## Frequency  667848 153552  69848  16638   4623
## Proportion  0.732  0.168  0.077  0.018  0.005
## ---------------------------------------------------------------------------
## sofa_liver 
##        n  missing distinct     Info     Mean      Gmd 
##   912509        0        5    0.261    0.155   0.2872 
##                                              
## Value           0      1      2      3      4
## Frequency  824760  46708  31852   5737   3452
## Proportion  0.904  0.051  0.035  0.006  0.004
## ---------------------------------------------------------------------------
## sofa_cardiovascular 
##        n  missing distinct     Info     Mean      Gmd 
##   912509        0        3    0.778    1.185     0.97 
##                                
## Value           0      1      3
## Frequency  193336 538176 180997
## Proportion  0.212  0.590  0.198
## ---------------------------------------------------------------------------
## sofa_cns 
##        n  missing distinct     Info     Mean      Gmd 
##   912509        0        5    0.794   0.8861    1.246 
##                                              
## Value           0      1      2      3      4
## Frequency  533497 152624  82389  84845  59154
## Proportion  0.585  0.167  0.090  0.093  0.065
## ---------------------------------------------------------------------------
## sofa_renal 
##        n  missing distinct     Info     Mean      Gmd 
##   912509        0        5    0.759   0.7813    1.143 
##                                              
## Value           0      1      2      3      4
## Frequency  562276 163728  70095  56639  59771
## Proportion  0.616  0.179  0.077  0.062  0.066
## ---------------------------------------------------------------------------
## sofa_renal_baseline 
##        n  missing distinct     Info     Mean      Gmd 
##   912509        0        2    0.097   0.1343   0.2596 
##                         
## Value           0      4
## Frequency  881875  30634
## Proportion  0.966  0.034
## ---------------------------------------------------------------------------
## sofa_liver_baseline 
##        n  missing distinct     Info     Mean      Gmd 
##   912509        0        2    0.061  0.08357   0.1637 
##                         
## Value           0      4
## Frequency  893444  19065
## Proportion  0.979  0.021
## ---------------------------------------------------------------------------
## sofa_respiration_baseline 
##        n  missing distinct     Info     Mean      Gmd 
##   912509        0        2    0.549   0.4819   0.7315 
##                         
## Value           0      2
## Frequency  692652 219857
## Proportion  0.759  0.241
## ---------------------------------------------------------------------------
## cardiovascular_baseline 
##        n  missing distinct 
##   912509        0        2 
##                         
## Value           0      1
## Frequency  705303 207206
## Proportion  0.773  0.227
## ---------------------------------------------------------------------------
## soi_alpha 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   614401   298108      468    0.999    2.997    0.536     2.50     2.52 
##      .25      .50      .75      .90      .95 
##     2.60     2.83     3.17     3.74     4.03 
## 
## lowest : 2.50 2.51 2.52 2.53 2.54, highest: 7.60 7.61 7.88 7.94 8.00
## ---------------------------------------------------------------------------
## soi_minutes 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   614401   298108      301    0.994    176.2    300.6      -60      -60 
##      .25      .50      .75      .90      .95 
##       -5       30      215      695      965 
## 
## lowest :  -60  -55  -50  -45  -40, highest: 1420 1425 1430 1435 1440
## ---------------------------------------------------------------------------
## od_alpha 
##        n  missing distinct     Info     Mean      Gmd 
##   760467   152042        7    0.352    1.173   0.3065 
##                                                            
## Value           1      2      3      4      5      6      7
## Frequency  657571  79763  18657   3839    572     63      2
## Proportion  0.865  0.105  0.025  0.005  0.001  0.000  0.000
## ---------------------------------------------------------------------------
## od_minutes 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   760467   152042      301    0.961    149.8    291.5      -60      -60 
##      .25      .50      .75      .90      .95 
##      -60       15      200      625      910 
## 
## lowest :  -60  -55  -50  -45  -40, highest: 1420 1425 1430 1435 1440
## ---------------------------------------------------------------------------
## both_soi_alpha 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   502508   410001      482    0.999    3.111    0.636     2.50     2.53 
##      .25      .50      .75      .90      .95 
##     2.65     2.95     3.35     4.00     4.37 
## 
## lowest : 2.50 2.51 2.52 2.53 2.54, highest: 7.83 7.88 7.94 8.00 9.00
## ---------------------------------------------------------------------------
## both_od_alpha 
##        n  missing distinct     Info     Mean      Gmd 
##   502508   410001        7    0.675     1.45    0.672 
##                                                            
## Value           1      2      3      4      5      6      7
## Frequency  341634 109399  39914   9748   1662    147      4
## Proportion  0.680  0.218  0.079  0.019  0.003  0.000  0.000
## ---------------------------------------------------------------------------
## both_minutes 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   502508   410001      301    0.996    225.9    347.6      -60      -60 
##      .25      .50      .75      .90      .95 
##        0       65      330      815     1055 
## 
## lowest :  -60  -55  -50  -45  -40, highest: 1420 1425 1430 1435 1440
## ---------------------------------------------------------------------------
## soi_alteredmentalstatus 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   614401   298108        2    0.148    32028  0.05213  0.09882 
## 
## ---------------------------------------------------------------------------
## soi_glucose 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   614401   298108      121    0.873   0.5743   0.4798      0.0      0.0 
##      .25      .50      .75      .90      .95 
##      0.0      0.8      1.0      1.0      1.0 
## 
## lowest : 0.00000000 0.01000000 0.02000000 0.03000000 0.03333333
## highest: 0.96666667 0.97000000 0.98000000 0.99000000 1.00000000
## ---------------------------------------------------------------------------
## soi_heartrate 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   614401   298108       21    0.896   0.6629   0.4226      0.0      0.0 
##      .25      .50      .75      .90      .95 
##      0.3      0.9      1.0      1.0      1.0 
## 
## lowest : 0.00 0.05 0.10 0.15 0.20, highest: 0.80 0.85 0.90 0.95 1.00
## ---------------------------------------------------------------------------
## soi_inr 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   614401   298108       61     0.57   0.1606   0.2655        0        0 
##      .25      .50      .75      .90      .95 
##        0        0        0        1        1 
## 
## lowest : 0.00000000 0.01666667 0.03333333 0.05000000 0.06666667
## highest: 0.93333333 0.95000000 0.96666667 0.98333333 1.00000000
## ---------------------------------------------------------------------------
## soi_respiratoryrate 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   614401   298108       53    0.956    0.661   0.3808   0.0000   0.0000 
##      .25      .50      .75      .90      .95 
##   0.4167   0.7500   1.0000   1.0000   1.0000 
## 
## lowest : 0.000000000 0.008333333 0.027777778 0.041666667 0.083333333
## highest: 0.944444444 0.958333333 0.972222222 0.983333333 1.000000000
## ---------------------------------------------------------------------------
## soi_temperature 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   614401   298108      257    0.724   0.1621   0.2557      0.0      0.0 
##      .25      .50      .75      .90      .95 
##      0.0      0.0      0.2      0.7      1.0 
## 
## lowest : 0.000000000 0.001764706 0.016470588 0.029411765 0.032679739
## highest: 0.980588235 0.982235294 0.982352941 0.997160000 1.000000000
## ---------------------------------------------------------------------------
## soi_bands 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   614401   298108      188    0.168  0.04862  0.09242      0.0      0.0 
##      .25      .50      .75      .90      .95 
##      0.0      0.0      0.0      0.0      0.5 
## 
## lowest : 0.00000000 0.00500000 0.01666667 0.01833333 0.02833333
## highest: 0.95166667 0.96000000 0.96666667 0.98333333 1.00000000
## ---------------------------------------------------------------------------
## soi_wbc 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   614401   298108      601    0.943   0.5307   0.4695   0.0000   0.0000 
##      .25      .50      .75      .90      .95 
##   0.0000   0.5667   1.0000   1.0000   1.0000 
## 
## lowest : 0.000000000 0.001666667 0.003333333 0.005000000 0.006666667
## highest: 0.993333333 0.995000000 0.996666667 0.998333333 1.000000000
## ---------------------------------------------------------------------------
## soi_lactate 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   614401   298108        2    0.371    88766   0.1445   0.2472 
## 
## ---------------------------------------------------------------------------
## od_liver 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   760467   152042        2    0.294    83849   0.1103   0.1962 
## 
## ---------------------------------------------------------------------------
## od_cardiovascular 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   760467   152042        2     0.74   423395   0.5568   0.4936 
## 
## ---------------------------------------------------------------------------
## od_respiratory 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   760467   152042        2    0.416   126479   0.1663   0.2773 
## 
## ---------------------------------------------------------------------------
## od_kidney 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   760467   152042        2    0.214    58932  0.07749    0.143 
## 
## ---------------------------------------------------------------------------
## od_lactate 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   760467   152042        2    0.296    84365   0.1109   0.1973 
## 
## ---------------------------------------------------------------------------
## od_metabolic 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   760467   152042        2    0.371   110108   0.1448   0.2477 
## 
## ---------------------------------------------------------------------------
## od_hematologic 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   760467   152042        2    0.018     4548 0.005981  0.01189 
## 
## ---------------------------------------------------------------------------
## both_soi_alteredmentalstatus 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   502508   410001        2    0.131    22935  0.04564  0.08712 
## 
## ---------------------------------------------------------------------------
## both_soi_glucose 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   502508   410001      121     0.87   0.5656   0.4832      0.0      0.0 
##      .25      .50      .75      .90      .95 
##      0.0      0.8      1.0      1.0      1.0 
## 
## lowest : 0.00000000 0.01000000 0.02000000 0.03000000 0.03333333
## highest: 0.96666667 0.97000000 0.98000000 0.99000000 1.00000000
## ---------------------------------------------------------------------------
## both_soi_heartrate 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   502508   410001       21    0.884   0.6666   0.4229      0.0      0.0 
##      .25      .50      .75      .90      .95 
##      0.3      0.9      1.0      1.0      1.0 
## 
## lowest : 0.00 0.05 0.10 0.15 0.20, highest: 0.80 0.85 0.90 0.95 1.00
## ---------------------------------------------------------------------------
## both_soi_inr 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   502508   410001       61    0.624   0.1812   0.2912   0.0000   0.0000 
##      .25      .50      .75      .90      .95 
##   0.0000   0.0000   0.1667   1.0000   1.0000 
## 
## lowest : 0.00000000 0.01666667 0.03333333 0.05000000 0.06666667
## highest: 0.93333333 0.95000000 0.96666667 0.98333333 1.00000000
## ---------------------------------------------------------------------------
## both_soi_respiratoryrate 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   502508   410001       51    0.949   0.6678   0.3831   0.0000   0.0000 
##      .25      .50      .75      .90      .95 
##   0.4167   0.7500   1.0000   1.0000   1.0000 
## 
## lowest : 0.000000000 0.008333333 0.027777778 0.041666667 0.055555556
## highest: 0.933333333 0.944444444 0.958333333 0.972222222 1.000000000
## ---------------------------------------------------------------------------
## both_soi_temperature 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   502508   410001      258    0.744    0.172   0.2677      0.0      0.0 
##      .25      .50      .75      .90      .95 
##      0.0      0.0      0.2      0.7      1.0 
## 
## lowest : 0.000000000 0.001764706 0.029411765 0.032679739 0.032941176
## highest: 0.980588235 0.982235294 0.982352941 0.997160000 1.000000000
## ---------------------------------------------------------------------------
## both_soi_bands 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   502508   410001      168    0.194  0.05737    0.108   0.0000   0.0000 
##      .25      .50      .75      .90      .95 
##   0.0000   0.0000   0.0000   0.0000   0.8333 
## 
## lowest : 0.000000000 0.008333333 0.016666667 0.018333333 0.028333333
## highest: 0.953333333 0.960000000 0.966666667 0.983333333 1.000000000
## ---------------------------------------------------------------------------
## both_soi_wbc 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   502508   410001      601    0.936   0.5657    0.464  0.00000  0.00000 
##      .25      .50      .75      .90      .95 
##  0.02333  0.65833  1.00000  1.00000  1.00000 
## 
## lowest : 0.000000000 0.001666667 0.003333333 0.005000000 0.006666667
## highest: 0.993333333 0.995000000 0.996666667 0.998333333 1.000000000
## ---------------------------------------------------------------------------
## both_soi_lactate 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   502508   410001        2    0.459    94798   0.1886   0.3061 
## 
## ---------------------------------------------------------------------------
## both_od_liver 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   502508   410001        2     0.41    81993   0.1632   0.2731 
## 
## ---------------------------------------------------------------------------
## both_od_cardiovascular 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   502508   410001        2    0.745   271953   0.5412   0.4966 
## 
## ---------------------------------------------------------------------------
## both_od_respiratory 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   502508   410001        2    0.556   123498   0.2458   0.3707 
## 
## ---------------------------------------------------------------------------
## both_od_kidney 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   502508   410001        2    0.234    42853  0.08528    0.156 
## 
## ---------------------------------------------------------------------------
## both_od_lactate 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   502508   410001        2    0.459    94798   0.1886   0.3061 
## 
## ---------------------------------------------------------------------------
## both_od_metabolic 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   502508   410001        2    0.506   107853   0.2146   0.3371 
## 
## ---------------------------------------------------------------------------
## both_od_hematologic 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   502508   410001        2    0.032     5438  0.01082  0.02141 
## 
## ---------------------------------------------------------------------------
## patientweight 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   898761    13748    13119        1     83.7    27.75    49.80    55.30 
##      .25      .50      .75      .90      .95 
##    66.00    80.00    96.71   115.67   130.00 
## 
## lowest :   0.00   0.09   0.27   0.40   0.50, highest: 909.90 949.00 953.00 956.00 969.00
## ---------------------------------------------------------------------------
## BMI 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   882077    30432   184910        1      Inf      NaN    18.50    20.29 
##      .25      .50      .75      .90      .95 
##    23.47    27.55    32.87    39.52    44.84 
## 
## lowest : 0.000000e+00 1.020408e-02 1.937504e-02 2.547485e-02 1.132216e-01
## highest: 1.352158e+06 1.504164e+06 1.598657e+06 1.999887e+06          Inf
## ---------------------------------------------------------------------------
## BMI_Ranges 
##        n  missing distinct 
##   912509        0        5 
##                                                                   
## Value           (0,18.5]     (18.5,25]       (25,35]      (35,200]
## Frequency          44009        257638        416522        162054
## Proportion         0.048         0.282         0.456         0.178
##                         
## Value      Other/Unknown
## Frequency          32286
## Proportion         0.035
## ---------------------------------------------------------------------------
## age_Ranges 
##        n  missing distinct 
##   912509        0        8 
##                                                                          
## Value        (0,25]  (25,35]  (35,45]  (45,55]  (55,65]  (65,75]  (75,85]
## Frequency     30083    45906    67771   136077   191660   200706   165443
## Proportion    0.033    0.050    0.074    0.149    0.210    0.220    0.181
##                    
## Value      (85,100]
## Frequency     74863
## Proportion    0.082
## ---------------------------------------------------------------------------
## hospitalLOS_Ranges 
##        n  missing distinct 
##   912506        3       10 
##                                                                       
## Value          (0,1]     (1,3]     (3,5]    (5,10]   (10,20]   (20,30]
## Frequency      42243    201490    185718    274367    152013     36187
## Proportion     0.046     0.221     0.204     0.301     0.167     0.040
##                                                   
## Value        (30,60]   (60,90]  (90,150] (150,999]
## Frequency      17656      1914       710       208
## Proportion     0.019     0.002     0.001     0.000
## ---------------------------------------------------------------------------
## icuLOS_Ranges 
##        n  missing distinct 
##   912509        0        8 
##                                                                          
## Value         (0,1]    (1,3]    (3,5]   (5,10]  (10,20]  (20,30]  (30,60]
## Frequency    222500   426937   128031    89011    36285     7092     2475
## Proportion    0.244    0.468    0.140    0.098    0.040    0.008    0.003
##                    
## Value      (60,999]
## Frequency       178
## Proportion    0.000
## ---------------------------------------------------------------------------
## ethnicity2 
##        n  missing distinct 
##   912509        0        6 
##                                                              
## Value             Caucasian African American         Hispanic
## Frequency            695367           105292            41393
## Proportion            0.762            0.115            0.045
##                                                              
## Value                 Asian  Native American    Other/Unknown
## Frequency             11695             6765            51997
## Proportion            0.013            0.007            0.057
## ---------------------------------------------------------------------------
## gender2 
##        n  missing distinct 
##   912509        0        3 
##                                                     
## Value               Male        Female Other/Unknown
## Frequency         490533        421748           228
## Proportion         0.538         0.462         0.000
## ---------------------------------------------------------------------------
## hospital_region2 
##        n  missing distinct 
##   912509        0        5 
##                                                             
## Value        Midwest Northeast     South      West   Unknown
## Frequency     383075     73523    283987    116783     55141
## Proportion     0.420     0.081     0.311     0.128     0.060
## ---------------------------------------------------------------------------
## sepsis_outcome 
##        n  missing distinct 
##   912509        0        2 
##                         
## Value       FALSE   TRUE
## Frequency  725639 186870
## Proportion  0.795  0.205
## ---------------------------------------------------------------------------
## group 
##        n  missing distinct 
##   912509        0       12 
## 
## Cardiovascular (295348, 0.324), Gastrointestinal (94673, 0.104),
## Gynaecological (2410, 0.003), Hematological (6819, 0.007), Metabolic
## (74865, 0.082), Muscoskeletal/Skin disease (11455, 0.013), Neurological
## (122910, 0.135), Renal/Genitourinary (22125, 0.024), Respiratory (136055,
## 0.149), Sepsis (97598, 0.107), Trauma (40495, 0.044), Undefined (7756,
## 0.008)
## ---------------------------------------------------------------------------
## post.operative 
##        n  missing distinct     Info      Sum     Mean      Gmd 
##   912509        0        2    0.459   172015   0.1885   0.3059 
## 
## ---------------------------------------------------------------------------
## code 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0      378    0.999      531    482.9      104      106 
##      .25      .50      .75      .90      .95 
##      201      403      703     1212     1413 
## 
## lowest :    0.01    0.02    0.03    0.04    0.05
## highest: 2201.01 2201.02 2201.03 2201.04 2201.05
## ---------------------------------------------------------------------------
## dx 
##        n  missing distinct 
##   912509        0      378 
## 
## lowest : Abdomen/extremity trauma                                                        Abdomen/face trauma                                                             Abdomen/multiple trauma                                                         Abdomen only trauma                                                             Abdomen/pelvis trauma                                                          
## highest: Vena cava clipping                                                              Vena cava filer insertion                                                       Ventriculostomy                                                                 Weaning from mechanical ventilation (transfer from other unit or hospital only) Whipple surgery for pancreatic cancer                                          
## ---------------------------------------------------------------------------
## number 
##        n  missing distinct     Info     Mean      Gmd 
##   912509        0        6    0.165    1.147   0.2811 
##                                                     
## Value           1      2      3      4      5      6
## Frequency  859197  16144  11817  11814   9081   4456
## Proportion  0.942  0.018  0.013  0.013  0.010  0.005
## ---------------------------------------------------------------------------
## admitdiagnosis 
##        n  missing distinct 
##   912509        0      401 
## 
## lowest : ACIDBASE   ACUHEPFAIL ADDISON    ADRENNEO   AIROBSTRX 
## highest: UNSTANGINA VARICBLEED VASCULITIS VIRALMYOSI WEANVENT  
## ---------------------------------------------------------------------------
## admitdxpath 
##        n  missing distinct 
##   912509        0      401 
## 
## lowest :                                                                                                                                      admission diagnosis|All Diagnosis|Non-operative|Diagnosis|Cardiovascular|Anaphylaxis                                                 admission diagnosis|All Diagnosis|Non-operative|Diagnosis|Cardiovascular|Aneurysm, dissecting aortic                                 admission diagnosis|All Diagnosis|Non-operative|Diagnosis|Cardiovascular|Aneurysm/pseudoaneurysm, other                              admission diagnosis|All Diagnosis|Non-operative|Diagnosis|Cardiovascular|Angina, stable (asymp or stable pattern of symptoms w/meds)
## highest: admission diagnosis|All Diagnosis|Operative|Diagnosis|Trauma|Extremity/multiple trauma, surgery for                                  admission diagnosis|All Diagnosis|Operative|Diagnosis|Trauma|Extremity only trauma, surgery for                                      admission diagnosis|All Diagnosis|Operative|Diagnosis|Trauma|Face/multiple trauma, surgery for                                       admission diagnosis|All Diagnosis|Operative|Diagnosis|Trauma|Face only trauma, surgery for                                           admission diagnosis|All Diagnosis|Operative|Diagnosis|Trauma|Trauma surgery, other                                                  
## ---------------------------------------------------------------------------
## numobs 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   911985      524      235        1     2610     2596       54      138 
##      .25      .50      .75      .90      .95 
##      548     2110     4389     6262     6790 
## 
## lowest :    0    1    2    3    4, highest: 5003 5989 6262 6790 8375
## ---------------------------------------------------------------------------
## possible.group 
##        n  missing distinct     Info     Mean      Gmd 
##     7454   905055        8    0.868     1030    589.9 
##                                                                           
## Value       312.00  408.02  602.09  802.00 1208.00 1504.00 1701.00 1705.03
## Frequency     2110     678      12     345     348    3551     178     232
## Proportion   0.283   0.091   0.002   0.046   0.047   0.476   0.024   0.031
## ---------------------------------------------------------------------------
## X 
##        n  missing distinct 
##   912509        0       13 
## 
## lowest :                                                                                                ANZICS addition                                                                                ANZICS Addition. Sub-categories won’t map well, but collapsing to hierarchy (1206) should work ANZICS addition – we have invented this diagnosis code                                         assumes admitted in eICU due to rejection                                                     
## highest: Chest pain, unknown origin                                                                     fuzzy match                                                                                    multiple matches                                                                               presumably ANZICS only allows the surgical version of this code                                there are 6 categories for this in eICU                                                       
## ---------------------------------------------------------------------------
## c_temp_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   895122    17387     1044    0.996    36.29   0.7768     35.1     35.6 
##      .25      .50      .75      .90      .95 
##     36.1     36.4     36.7     36.9     37.1 
## 
## lowest :   0.1   0.2   0.5   0.6   0.8, highest: 100.3 100.7 100.8 100.9 101.0
## ---------------------------------------------------------------------------
## c_temp_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   895122    17387      757    0.997    37.32   0.8268    36.40    36.60 
##      .25      .50      .75      .90      .95 
##    36.90    37.17    37.60    38.20    38.70 
## 
## lowest :   0.10  19.90  21.70  24.40  27.40, highest: 104.50 105.55 105.80 107.20 111.20
## ---------------------------------------------------------------------------
## c_HR_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0      274        1    102.9    24.95       70       76 
##      .25      .50      .75      .90      .95 
##       87      101      116      132      143 
## 
## lowest :   5   7  14  15  18, highest: 320 347 360 361 379
## ---------------------------------------------------------------------------
## c_resp_max 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0      181    0.998    28.01    9.715       18       19 
##      .25      .50      .75      .90      .95 
##       22       26       31       39       46 
## 
## lowest :   1   2   3   4   5, highest: 187 194 196 197 199
## ---------------------------------------------------------------------------
## c_sbp_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912325      184      271        1    92.14    26.45       52       62 
##      .25      .50      .75      .90      .95 
##       78       92      107      121      131 
## 
## lowest :   1   2   3   4   5, highest: 240 244 246 248 256
## ---------------------------------------------------------------------------
## c_mbp_min 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0      282        1    66.76     21.4       41       46 
##      .25      .50      .75      .90      .95 
##       54       64       75       89      104 
## 
## lowest :   0.13   0.61   0.74   0.87   1.00, highest: 198.00 199.00 200.00 232.00 287.00
## ---------------------------------------------------------------------------
## icu_admit_source2 
##        n  missing distinct 
##   912509        0        6 
##                                                                          
## Value                     Floor         OR/Proc Area         Direct Admit
## Frequency                154636               176443                98038
## Proportion                0.169                0.193                0.107
##                                                                          
## Value      Emergency Department                Other       Step-Down Unit
## Frequency                456475                 7763                19154
## Proportion                0.500                0.009                0.021
## ---------------------------------------------------------------------------
## icu_type2 
##        n  missing distinct 
##   912509        0        8 
## 
## Trauma ICU (10946, 0.012), Cardiac Care ICU (65472, 0.072),
## Cardiac/Surgical Care ICU (141274, 0.155), Medical/Surgical ICU (468867,
## 0.514), Medical ICU (86772, 0.095), Other ICU (2616, 0.003), Neuro ICU
## (71250, 0.078), Surgical ICU (65312, 0.072)
## ---------------------------------------------------------------------------
## icu_disch_location2 
##        n  missing distinct 
##   912509        0        7 
##                                                                       
## Value               Floor          Death           Home      SNF/Rehab
## Frequency          665016          61357          88591          14116
## Proportion          0.729          0.067          0.097          0.015
##                                                        
## Value               Other Other Hospital Step-Down Unit
## Frequency           29315          20636          33478
## Proportion          0.032          0.023          0.037
## ---------------------------------------------------------------------------
## physicianSpeciality2 
##        n  missing distinct 
##   912509        0        2 
##                                             
## Value         Critical Care Speciality-Other
## Frequency            267236           645273
## Proportion            0.293            0.707
## ---------------------------------------------------------------------------
## sofa_respiration_baseline2 
##        n  missing distinct 
##   912509        0        2 
##                         
## Value       FALSE   TRUE
## Frequency  692652 219857
## Proportion  0.759  0.241
## ---------------------------------------------------------------------------
## sofa_renal_baseline2 
##        n  missing distinct 
##   912509        0        2 
##                         
## Value       FALSE   TRUE
## Frequency  881875  30634
## Proportion  0.966  0.034
## ---------------------------------------------------------------------------
## sofa_liver_baseline2 
##        n  missing distinct 
##   912509        0        2 
##                         
## Value       FALSE   TRUE
## Frequency  893444  19065
## Proportion  0.979  0.021
## ---------------------------------------------------------------------------
## SOFA_Change 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0       24     0.98    3.519    3.134        0        1 
##      .25      .50      .75      .90      .95 
##        1        3        5        8        9 
## 
## lowest :  0  1  2  3  4, highest: 19 20 21 22 23
## ---------------------------------------------------------------------------
## SOFA_Positive 
##        n  missing distinct 
##   912509        0        2 
##                         
## Value       FALSE   TRUE
## Frequency  284293 628216
## Proportion  0.312  0.688
## ---------------------------------------------------------------------------
## SOFA_Score 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   912509        0       24    0.983     3.77    3.341        0        1 
##      .25      .50      .75      .90      .95 
##        1        3        5        8       10 
## 
## lowest :  0  1  2  3  4, highest: 19 20 21 22 23
## ---------------------------------------------------------------------------
## SOFA_Positive2 
##        n  missing distinct 
##   912509        0        2 
##                         
## Value       FALSE   TRUE
## Frequency  267445 645064
## Proportion  0.293  0.707
## ---------------------------------------------------------------------------
## GCS_qSOFA 
##        n  missing distinct 
##   912509        0        2 
##                         
## Value       FALSE   TRUE
## Frequency  533497 379012
## Proportion  0.585  0.415
## ---------------------------------------------------------------------------
## BP_qSOFA 
##        n  missing distinct 
##   912325      184        2 
##                         
## Value       FALSE   TRUE
## Frequency  314799 597526
## Proportion  0.345  0.655
## ---------------------------------------------------------------------------
## Resp_qSOFA 
##        n  missing distinct 
##   912509        0        2 
##                         
## Value       FALSE   TRUE
## Frequency  208008 704501
## Proportion  0.228  0.772
## ---------------------------------------------------------------------------
## qSOFA_total 
##        n  missing distinct     Info     Mean      Gmd 
##   912509        0        4    0.889    1.842   0.9391 
##                                       
## Value           0      1      2      3
## Frequency   64765 234728 392737 220279
## Proportion  0.071  0.257  0.430  0.241
## ---------------------------------------------------------------------------
## qSOFA_Positive 
##        n  missing distinct 
##   912509        0        2 
##                         
## Value       FALSE   TRUE
## Frequency  299493 613016
## Proportion  0.328  0.672
## ---------------------------------------------------------------------------
## temp_SIRS 
##        n  missing distinct 
##   895122    17387        2 
##                         
## Value       FALSE   TRUE
## Frequency  618206 276916
## Proportion  0.691  0.309
## ---------------------------------------------------------------------------
## wbc_SIRS 
##        n  missing distinct 
##   794753   117756        2 
##                         
## Value       FALSE   TRUE
## Frequency  424426 370327
## Proportion  0.534  0.466
## ---------------------------------------------------------------------------
## resp_SIRS 
##        n  missing distinct 
##   912509        0        2 
##                         
## Value       FALSE   TRUE
## Frequency  149689 762820
## Proportion  0.164  0.836
## ---------------------------------------------------------------------------
## HR_SIRS 
##        n  missing distinct 
##   912509        0        2 
##                         
## Value       FALSE   TRUE
## Frequency  284634 627875
## Proportion  0.312  0.688
## ---------------------------------------------------------------------------
## SIRS_total 
##        n  missing distinct     Info     Mean      Gmd 
##   912509        0        5    0.924    2.233    1.157 
##                                              
## Value           0      1      2      3      4
## Frequency   49299 169356 319467 267900 106487
## Proportion  0.054  0.186  0.350  0.294  0.117
## ---------------------------------------------------------------------------
## SIRS_Positive 
##        n  missing distinct 
##   912509        0        2 
##                         
## Value       FALSE   TRUE
## Frequency  218655 693854
## Proportion   0.24   0.76
## ---------------------------------------------------------------------------
## StickyMinutes 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##   540443   372066      301    0.997    252.6    371.6      -60      -60 
##      .25      .50      .75      .90      .95 
##        5       80      400      865     1095 
## 
## lowest :  -60  -55  -50  -45  -40, highest: 1420 1425 1430 1435 1440
## ---------------------------------------------------------------------------
## FuzzyTotal1 
##        n  missing distinct     Info     Mean      Gmd 
##   912509        0        3    0.758    1.507   0.6395 
##                                
## Value           0      1      2
## Frequency   78084 293982 540443
## Proportion  0.086  0.322  0.592
## ---------------------------------------------------------------------------
## SimultaneousMinutes 
##        n  missing distinct 
##   912509        0        2 
##                         
## Value       FALSE   TRUE
## Frequency  410001 502508
## Proportion  0.449  0.551
## ---------------------------------------------------------------------------
## SepsisFuzzyLogicPositive 
##        n  missing distinct 
##   912509        0        2 
##                         
## Value       FALSE   TRUE
## Frequency  410001 502508
## Proportion  0.449  0.551
## ---------------------------------------------------------------------------
## SepsisFuzzyLogicPositive2 
##        n  missing distinct 
##   912509        0        2 
##                         
## Value       FALSE   TRUE
## Frequency  410001 502508
## Proportion  0.449  0.551
## ---------------------------------------------------------------------------
## hasDiagnosisCodes 
##        n  missing distinct    value 
##   912509        0        1     TRUE 
##                  
## Value        TRUE
## Frequency  912509
## Proportion      1
## ---------------------------------------------------------------------------
## 
## Variables with all observations missing:
## 
## [1] hospital_type icu_size

17 Seeding/Splitting

Setting the seed and splitting into datasets for training and testing the model

#install.packages("caret")
library(caret); library(Hmisc)
## 
## Attaching package: 'caret'
## The following object is masked from 'package:purrr':
## 
##     lift
## The following object is masked from 'package:survival':
## 
##     cluster
set.seed(999)

ssd_incl <- ssd_incl %>%mutate(SOFA_Change=cut2(SOFA_Change, seq(0,18)))

datasplit <- createDataPartition(ssd_incl$hospital_mortality_ultimate==1,times=1,p=0.7)
ssd_incl_tr <- ssd_incl[datasplit[[1]],]
nrow(ssd_incl_tr)
## [1] 638757
ssd_incl_tr$hospital_mortality_ultimate<-as.factor (ssd_incl_tr$hospital_mortality_ultimate)
ssd_incl_tr$sepsis_outcome<-as.factor (ssd_incl_tr$sepsis_outcome)

18 Baseline Mortality

GLM and Train on training set and predictions/performance (ROC, SENS, SPEC, PPV, NPV, accuracy) on test set

library(sjPlot); library(ROCR); library(Hmisc); library(pROC); library(randomForest)
## Loading required package: gplots
## 
## Attaching package: 'gplots'
## The following object is masked from 'package:stats':
## 
##     lowess
## Type 'citation("pROC")' for a citation.
## 
## Attaching package: 'pROC'
## The following objects are masked from 'package:stats':
## 
##     cov, smooth, var
## randomForest 4.6-12
## Type rfNews() to see new features/changes/bug fixes.
## 
## Attaching package: 'randomForest'
## The following object is masked from 'package:ggplot2':
## 
##     margin
## The following object is masked from 'package:dplyr':
## 
##     combine
Baseline_Hosp_Mort_tr<-glm(hospital_mortality_ultimate ~ age_Ranges + gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + hospital_teaching_status + hospital_size + physicianSpeciality2 + hospitaldischargeyear + dialysis + aids + hepaticfailure + diabetes + immunosuppression + leukemia + lymphoma + metastaticcancer + thrombolytics + sofa_respiration_baseline2 + cardiovascular_baseline, data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(Baseline_Hosp_Mort_tr)
#sjt.glm(Baseline_Hosp_Mort_tr)

#drop1(Baseline_Hosp_Mort_tr,test="Chisq")

summary(Baseline_Hosp_Mort_tr)
## 
## Call:
## glm(formula = hospital_mortality_ultimate ~ age_Ranges + gender2 + 
##     ethnicity2 + BMI_Ranges + icu_admit_source2 + hospital_teaching_status + 
##     hospital_size + physicianSpeciality2 + hospitaldischargeyear + 
##     dialysis + aids + hepaticfailure + diabetes + immunosuppression + 
##     leukemia + lymphoma + metastaticcancer + thrombolytics + 
##     sofa_respiration_baseline2 + cardiovascular_baseline, family = "binomial", 
##     data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.6276  -0.4936  -0.3733  -0.2677   3.1470  
## 
## Coefficients:
##                                        Estimate Std. Error z value
## (Intercept)                           -2.250932   0.050527 -44.549
## age_Ranges(25,35]                      0.229442   0.049062   4.677
## age_Ranges(35,45]                      0.418396   0.045277   9.241
## age_Ranges(45,55]                      0.757457   0.041906  18.075
## age_Ranges(55,65]                      1.026053   0.041085  24.974
## age_Ranges(65,75]                      1.282694   0.040902  31.360
## age_Ranges(75,85]                      1.578865   0.040839  38.661
## age_Ranges(85,100]                     1.824671   0.041638  43.822
## gender2Female                         -0.067416   0.008936  -7.544
## gender2Other/Unknown                   1.840225   0.177099  10.391
## ethnicity2African American            -0.006201   0.014720  -0.421
## ethnicity2Hispanic                     0.075543   0.021220   3.560
## ethnicity2Asian                        0.140192   0.037547   3.734
## ethnicity2Native American              0.413400   0.048960   8.444
## ethnicity2Other/Unknown                0.196662   0.018991  10.355
## BMI_Ranges(18.5,25]                   -0.328096   0.018575 -17.663
## BMI_Ranges(25,35]                     -0.504116   0.018321 -27.516
## BMI_Ranges(35,200]                    -0.375889   0.020472 -18.361
## BMI_RangesOther/Unknown               -0.051990   0.026790  -1.941
## icu_admit_source2OR/Proc Area         -1.475248   0.017523 -84.191
## icu_admit_source2Direct Admit         -0.393215   0.015587 -25.227
## icu_admit_source2Emergency Department -0.489498   0.010756 -45.509
## icu_admit_source2Other                -0.093568   0.040517  -2.309
## icu_admit_source2Step-Down Unit        0.167136   0.024843   6.728
## hospital_teaching_statusf             -0.053537   0.032153  -1.665
## hospital_teaching_statust             -0.144347   0.032493  -4.442
## hospital_size<100                     -0.560120   0.036404 -15.386
## hospital_size100-249                  -0.057453   0.025300  -2.271
## hospital_size250-500                   0.085279   0.025555   3.337
## hospital_size>500                      0.229786   0.023791   9.659
## physicianSpeciality2Speciality-Other  -0.431226   0.009850 -43.778
## hospitaldischargeyear2011             -0.024672   0.016825  -1.466
## hospitaldischargeyear2012             -0.070520   0.016231  -4.345
## hospitaldischargeyear2013             -0.121428   0.015964  -7.607
## hospitaldischargeyear2014             -0.172203   0.015908 -10.825
## hospitaldischargeyear2015-16          -0.139292   0.015732  -8.854
## dialysis1                              0.330458   0.022266  14.841
## aids1                                  0.556828   0.117003   4.759
## hepaticfailureTRUE                     0.760290   0.024386  31.178
## diabetes1                             -0.279194   0.011551 -24.170
## immunosuppression1                     0.379349   0.025108  15.108
## leukemia1                              0.511737   0.039519  12.949
## lymphoma1                              0.287931   0.056424   5.103
## metastaticcancer1                      0.681493   0.026194  26.017
## thrombolytics1                        -0.034820   0.034356  -1.014
## sofa_respiration_baseline2TRUE         0.086748   0.010077   8.608
## cardiovascular_baseline1               0.110204   0.010275  10.726
##                                       Pr(>|z|)    
## (Intercept)                            < 2e-16 ***
## age_Ranges(25,35]                     2.92e-06 ***
## age_Ranges(35,45]                      < 2e-16 ***
## age_Ranges(45,55]                      < 2e-16 ***
## age_Ranges(55,65]                      < 2e-16 ***
## age_Ranges(65,75]                      < 2e-16 ***
## age_Ranges(75,85]                      < 2e-16 ***
## age_Ranges(85,100]                     < 2e-16 ***
## gender2Female                         4.55e-14 ***
## gender2Other/Unknown                   < 2e-16 ***
## ethnicity2African American            0.673568    
## ethnicity2Hispanic                    0.000371 ***
## ethnicity2Asian                       0.000189 ***
## ethnicity2Native American              < 2e-16 ***
## ethnicity2Other/Unknown                < 2e-16 ***
## BMI_Ranges(18.5,25]                    < 2e-16 ***
## BMI_Ranges(25,35]                      < 2e-16 ***
## BMI_Ranges(35,200]                     < 2e-16 ***
## BMI_RangesOther/Unknown               0.052304 .  
## icu_admit_source2OR/Proc Area          < 2e-16 ***
## icu_admit_source2Direct Admit          < 2e-16 ***
## icu_admit_source2Emergency Department  < 2e-16 ***
## icu_admit_source2Other                0.020926 *  
## icu_admit_source2Step-Down Unit       1.72e-11 ***
## hospital_teaching_statusf             0.095900 .  
## hospital_teaching_statust             8.90e-06 ***
## hospital_size<100                      < 2e-16 ***
## hospital_size100-249                  0.023158 *  
## hospital_size250-500                  0.000847 ***
## hospital_size>500                      < 2e-16 ***
## physicianSpeciality2Speciality-Other   < 2e-16 ***
## hospitaldischargeyear2011             0.142539    
## hospitaldischargeyear2012             1.40e-05 ***
## hospitaldischargeyear2013             2.81e-14 ***
## hospitaldischargeyear2014              < 2e-16 ***
## hospitaldischargeyear2015-16           < 2e-16 ***
## dialysis1                              < 2e-16 ***
## aids1                                 1.94e-06 ***
## hepaticfailureTRUE                     < 2e-16 ***
## diabetes1                              < 2e-16 ***
## immunosuppression1                     < 2e-16 ***
## leukemia1                              < 2e-16 ***
## lymphoma1                             3.34e-07 ***
## metastaticcancer1                      < 2e-16 ***
## thrombolytics1                        0.310814    
## sofa_respiration_baseline2TRUE         < 2e-16 ***
## cardiovascular_baseline1               < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 399603  on 638756  degrees of freedom
## Residual deviance: 370829  on 638710  degrees of freedom
## AIC: 370923
## 
## Number of Fisher Scoring iterations: 6
ssd_incl_te <- ssd_incl[-datasplit[[1]],]
nrow(ssd_incl_te)
## [1] 273752
ssd_incl_te$BaselineHospMortPred <- predict(Baseline_Hosp_Mort_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")
ssd_incl_te$BaselineDec <-cut2(ssd_incl_te$BaselineHospMortPred, g=10)

BaselineMort.Pred <- prediction(ssd_incl_te$BaselineHospMortPred, ssd_incl_te$hospital_mortality_ultimate)
BaselineMort.Perf <- performance(BaselineMort.Pred, "tpr", "fpr")
plot(BaselineMort.Perf, main = "Baseline Mortality 
     Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(BaselineMort.Pred,"auc")@y.values[[1]],3))) 

performance(BaselineMort.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.7063341
## 
## 
## Slot "alpha.values":
## list()
BaselineMort.Pred.roc <- roc(hospital_mortality_ultimate~BaselineHospMortPred,data=ssd_incl_te,algorithm=3,ci=TRUE)
try(ci(BaselineMort.Pred.roc, conf.level=0.99))
## 99% CI: 0.7021-0.7105 (DeLong)
ggplot(calibration(as.factor(hospital_mortality_ultimate==0)~BaselineHospMortPred, data = ssd_incl_te))+ggtitle("Calibration of Baseline Mortality Prediction")
## Warning: Removed 2 rows containing missing values (geom_errorbar).

qplot(BaselineHospMortPred, data = ssd_incl_te)+ggtitle("Histogram of Baseline Mortality Predictions") 
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

19 Cross validation

partitions the data into 5 groups and then uses the 4 groups to predict the 5th group. It does this 5 times and then takes the average, ROC curves,

Train/glm completed on the train dataset; prediction and performance completed on the test dataset.

SIRS1_ADJ_Hosp_Mort_tr<-glm(hospital_mortality_ultimate ~ as.factor(SIRS_total) + age_Ranges + gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + hospital_teaching_status + hospital_size + physicianSpeciality2 + hospitaldischargeyear + dialysis + aids + hepaticfailure  + diabetes + immunosuppression + leukemia + lymphoma + metastaticcancer + thrombolytics + sofa_respiration_baseline2 + cardiovascular_baseline, data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(SIRS1_ADJ_Hosp_Mort_tr)
#sjt.glm(SIRS1_ADJ_Hosp_Mort_tr)

#drop1(SIRS1_ADJ_Hosp_Mort_tr,test="Chisq")

summary(SIRS1_ADJ_Hosp_Mort_tr)
## 
## Call:
## glm(formula = hospital_mortality_ultimate ~ as.factor(SIRS_total) + 
##     age_Ranges + gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + 
##     hospital_teaching_status + hospital_size + physicianSpeciality2 + 
##     hospitaldischargeyear + dialysis + aids + hepaticfailure + 
##     diabetes + immunosuppression + leukemia + lymphoma + metastaticcancer + 
##     thrombolytics + sofa_respiration_baseline2 + cardiovascular_baseline, 
##     family = "binomial", data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.9172  -0.4682  -0.3119  -0.1981   3.5016  
## 
## Coefficients:
##                                         Estimate Std. Error z value
## (Intercept)                           -4.4033273  0.0669083 -65.811
## as.factor(SIRS_total)1                 0.5500217  0.0456838  12.040
## as.factor(SIRS_total)2                 1.3688529  0.0433032  31.611
## as.factor(SIRS_total)3                 2.1573331  0.0430423  50.121
## as.factor(SIRS_total)4                 2.9515996  0.0434567  67.920
## age_Ranges(25,35]                      0.2570893  0.0496437   5.179
## age_Ranges(35,45]                      0.4780080  0.0458350  10.429
## age_Ranges(45,55]                      0.8663145  0.0424222  20.421
## age_Ranges(55,65]                      1.1531623  0.0415890  27.728
## age_Ranges(65,75]                      1.4393826  0.0414225  34.749
## age_Ranges(75,85]                      1.7665530  0.0413879  42.683
## age_Ranges(85,100]                     2.0380748  0.0422738  48.211
## gender2Female                         -0.0819955  0.0092092  -8.904
## gender2Other/Unknown                   1.6827393  0.1915034   8.787
## ethnicity2African American             0.0242863  0.0151634   1.602
## ethnicity2Hispanic                     0.0695744  0.0219392   3.171
## ethnicity2Asian                        0.1390930  0.0388335   3.582
## ethnicity2Native American              0.3755676  0.0506218   7.419
## ethnicity2Other/Unknown                0.2039346  0.0196154  10.397
## BMI_Ranges(18.5,25]                   -0.2889067  0.0192326 -15.022
## BMI_Ranges(25,35]                     -0.4412794  0.0189637 -23.270
## BMI_Ranges(35,200]                    -0.3240074  0.0211512 -15.319
## BMI_RangesOther/Unknown                0.1534701  0.0278737   5.506
## icu_admit_source2OR/Proc Area         -1.5161274  0.0178884 -84.755
## icu_admit_source2Direct Admit         -0.2696384  0.0161692 -16.676
## icu_admit_source2Emergency Department -0.3857470  0.0111422 -34.620
## icu_admit_source2Other                -0.1105148  0.0419398  -2.635
## icu_admit_source2Step-Down Unit        0.1265906  0.0257888   4.909
## hospital_teaching_statusf             -0.0858692  0.0331260  -2.592
## hospital_teaching_statust             -0.2064886  0.0336210  -6.142
## hospital_size<100                     -0.4533840  0.0372893 -12.159
## hospital_size100-249                   0.0006072  0.0260174   0.023
## hospital_size250-500                   0.0593403  0.0262684   2.259
## hospital_size>500                      0.2299083  0.0245490   9.365
## physicianSpeciality2Speciality-Other  -0.2499178  0.0101859 -24.536
## hospitaldischargeyear2011             -0.0510514  0.0174171  -2.931
## hospitaldischargeyear2012             -0.0858751  0.0167892  -5.115
## hospitaldischargeyear2013             -0.1243127  0.0165072  -7.531
## hospitaldischargeyear2014             -0.1521628  0.0164394  -9.256
## hospitaldischargeyear2015-16          -0.1431594  0.0162584  -8.805
## dialysis1                              0.3714920  0.0230898  16.089
## aids1                                  0.4083058  0.1206597   3.384
## hepaticfailureTRUE                     0.7758289  0.0253976  30.547
## diabetes1                             -0.2798912  0.0118792 -23.561
## immunosuppression1                     0.2714149  0.0259178  10.472
## leukemia1                              0.2929703  0.0409368   7.157
## lymphoma1                              0.1928275  0.0583328   3.306
## metastaticcancer1                      0.6544569  0.0271533  24.102
## thrombolytics1                         0.1077904  0.0355692   3.030
## sofa_respiration_baseline2TRUE         0.0299530  0.0103894   2.883
## cardiovascular_baseline1               0.1949686  0.0106352  18.332
##                                       Pr(>|z|)    
## (Intercept)                            < 2e-16 ***
## as.factor(SIRS_total)1                 < 2e-16 ***
## as.factor(SIRS_total)2                 < 2e-16 ***
## as.factor(SIRS_total)3                 < 2e-16 ***
## as.factor(SIRS_total)4                 < 2e-16 ***
## age_Ranges(25,35]                     2.23e-07 ***
## age_Ranges(35,45]                      < 2e-16 ***
## age_Ranges(45,55]                      < 2e-16 ***
## age_Ranges(55,65]                      < 2e-16 ***
## age_Ranges(65,75]                      < 2e-16 ***
## age_Ranges(75,85]                      < 2e-16 ***
## age_Ranges(85,100]                     < 2e-16 ***
## gender2Female                          < 2e-16 ***
## gender2Other/Unknown                   < 2e-16 ***
## ethnicity2African American            0.109234    
## ethnicity2Hispanic                    0.001518 ** 
## ethnicity2Asian                       0.000341 ***
## ethnicity2Native American             1.18e-13 ***
## ethnicity2Other/Unknown                < 2e-16 ***
## BMI_Ranges(18.5,25]                    < 2e-16 ***
## BMI_Ranges(25,35]                      < 2e-16 ***
## BMI_Ranges(35,200]                     < 2e-16 ***
## BMI_RangesOther/Unknown               3.67e-08 ***
## icu_admit_source2OR/Proc Area          < 2e-16 ***
## icu_admit_source2Direct Admit          < 2e-16 ***
## icu_admit_source2Emergency Department  < 2e-16 ***
## icu_admit_source2Other                0.008412 ** 
## icu_admit_source2Step-Down Unit       9.17e-07 ***
## hospital_teaching_statusf             0.009536 ** 
## hospital_teaching_statust             8.17e-10 ***
## hospital_size<100                      < 2e-16 ***
## hospital_size100-249                  0.981380    
## hospital_size250-500                  0.023883 *  
## hospital_size>500                      < 2e-16 ***
## physicianSpeciality2Speciality-Other   < 2e-16 ***
## hospitaldischargeyear2011             0.003378 ** 
## hospitaldischargeyear2012             3.14e-07 ***
## hospitaldischargeyear2013             5.04e-14 ***
## hospitaldischargeyear2014              < 2e-16 ***
## hospitaldischargeyear2015-16           < 2e-16 ***
## dialysis1                              < 2e-16 ***
## aids1                                 0.000715 ***
## hepaticfailureTRUE                     < 2e-16 ***
## diabetes1                              < 2e-16 ***
## immunosuppression1                     < 2e-16 ***
## leukemia1                             8.27e-13 ***
## lymphoma1                             0.000948 ***
## metastaticcancer1                      < 2e-16 ***
## thrombolytics1                        0.002442 ** 
## sofa_respiration_baseline2TRUE        0.003939 ** 
## cardiovascular_baseline1               < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 399603  on 638756  degrees of freedom
## Residual deviance: 342338  on 638706  degrees of freedom
## AIC: 342440
## 
## Number of Fisher Scoring iterations: 6
ssd_incl_te$SIRS1ADJHospMortPred <- predict(SIRS1_ADJ_Hosp_Mort_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")

SIRS1ADJMort.Pred <- prediction(ssd_incl_te$SIRS1ADJHospMortPred, ssd_incl_te$hospital_mortality_ultimate)
SIRS1ADJMort.Perf <- performance(SIRS1ADJMort.Pred, "tpr", "fpr")
plot(SIRS1ADJMort.Perf, main = "SIRS Continuous Adjusted
     Mortality Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(SIRS1ADJMort.Pred,"auc")@y.values[[1]],3))) 

performance(SIRS1ADJMort.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.781489
## 
## 
## Slot "alpha.values":
## list()
SIRS1ADJMort.Pred.roc <- roc(hospital_mortality_ultimate~ SIRS1ADJHospMortPred,data=ssd_incl_te)
ci(SIRS1ADJMort.Pred.roc, conf.level=0.99)
## 99% CI: 0.7779-0.7851 (DeLong)
ggplot(calibration(as.factor(hospital_mortality_ultimate==0)~SIRS1ADJHospMortPred, data = ssd_incl_te))+ggtitle("Calibration of ADJ Mortality SIRS Total Prediction")
## Warning: Removed 1 rows containing missing values (geom_errorbar).

qplot(SIRS1ADJHospMortPred, data = ssd_incl_te)+ggtitle("Histogram of ADJ Mortality SIRS Total Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

SIRS2_ADJ_Hosp_Mort_tr<-glm(hospital_mortality_ultimate ~ as.factor(SIRS_Positive) + age_Ranges + gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + hospital_teaching_status + hospital_size + physicianSpeciality2 + hospitaldischargeyear + dialysis + aids + hepaticfailure  + diabetes + immunosuppression + leukemia + lymphoma + metastaticcancer + thrombolytics + sofa_respiration_baseline2 + cardiovascular_baseline, data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(SIRS2_ADJ_Hosp_Mort_tr)
#sjt.glm(SIRS2_ADJ_Hosp_Mort_tr)

#drop1(SIRS2_ADJ_Hosp_Mort_tr,test="Chisq")

summary(SIRS2_ADJ_Hosp_Mort_tr)
## 
## Call:
## glm(formula = hospital_mortality_ultimate ~ as.factor(SIRS_Positive) + 
##     age_Ranges + gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + 
##     hospital_teaching_status + hospital_size + physicianSpeciality2 + 
##     hospitaldischargeyear + dialysis + aids + hepaticfailure + 
##     diabetes + immunosuppression + leukemia + lymphoma + metastaticcancer + 
##     thrombolytics + sofa_respiration_baseline2 + cardiovascular_baseline, 
##     family = "binomial", data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.7460  -0.5041  -0.3420  -0.2201   3.5149  
## 
## Coefficients:
##                                         Estimate Std. Error z value
## (Intercept)                           -3.7353712  0.0533820 -69.974
## as.factor(SIRS_Positive)TRUE           1.5501007  0.0166049  93.352
## age_Ranges(25,35]                      0.2341878  0.0491700   4.763
## age_Ranges(35,45]                      0.4422036  0.0453825   9.744
## age_Ranges(45,55]                      0.8133442  0.0420051  19.363
## age_Ranges(55,65]                      1.1012734  0.0411813  26.742
## age_Ranges(65,75]                      1.3673261  0.0410022  33.348
## age_Ranges(75,85]                      1.6711568  0.0409490  40.811
## age_Ranges(85,100]                     1.9118926  0.0417794  45.762
## gender2Female                         -0.0827101  0.0090284  -9.161
## gender2Other/Unknown                   1.8353850  0.1840623   9.972
## ethnicity2African American            -0.0001864  0.0148589  -0.013
## ethnicity2Hispanic                     0.0817242  0.0214713   3.806
## ethnicity2Asian                        0.1443329  0.0380038   3.798
## ethnicity2Native American              0.4002222  0.0495443   8.078
## ethnicity2Other/Unknown                0.2080260  0.0192215  10.823
## BMI_Ranges(18.5,25]                   -0.2970890  0.0187827 -15.817
## BMI_Ranges(25,35]                     -0.4496792  0.0185246 -24.275
## BMI_Ranges(35,200]                    -0.3290523  0.0206832 -15.909
## BMI_RangesOther/Unknown                0.0630207  0.0272240   2.315
## icu_admit_source2OR/Proc Area         -1.4644246  0.0176261 -83.083
## icu_admit_source2Direct Admit         -0.3052330  0.0158092 -19.307
## icu_admit_source2Emergency Department -0.4319494  0.0108865 -39.677
## icu_admit_source2Other                -0.0931470  0.0409624  -2.274
## icu_admit_source2Step-Down Unit        0.1531999  0.0251306   6.096
## hospital_teaching_statusf             -0.1022073  0.0324836  -3.146
## hospital_teaching_statust             -0.2091128  0.0328309  -6.369
## hospital_size<100                     -0.4951941  0.0367083 -13.490
## hospital_size100-249                  -0.0014247  0.0255296  -0.056
## hospital_size250-500                   0.1068927  0.0257786   4.147
## hospital_size>500                      0.2642215  0.0240025  11.008
## physicianSpeciality2Speciality-Other  -0.3415485  0.0099516 -34.321
## hospitaldischargeyear2011             -0.0458901  0.0170360  -2.694
## hospitaldischargeyear2012             -0.0964850  0.0164294  -5.873
## hospitaldischargeyear2013             -0.1540092  0.0161579  -9.531
## hospitaldischargeyear2014             -0.1953215  0.0160985 -12.133
## hospitaldischargeyear2015-16          -0.1779590  0.0159188 -11.179
## dialysis1                              0.3472659  0.0225635  15.391
## aids1                                  0.5049126  0.1177279   4.289
## hepaticfailureTRUE                     0.7541447  0.0247125  30.517
## diabetes1                             -0.2783472  0.0116522 -23.888
## immunosuppression1                     0.3302446  0.0252849  13.061
## leukemia1                              0.4274687  0.0398403  10.730
## lymphoma1                              0.2517849  0.0569702   4.420
## metastaticcancer1                      0.6437225  0.0264597  24.328
## thrombolytics1                         0.0868257  0.0348889   2.489
## sofa_respiration_baseline2TRUE         0.0241130  0.0101831   2.368
## cardiovascular_baseline1               0.1469103  0.0104055  14.119
##                                       Pr(>|z|)    
## (Intercept)                            < 2e-16 ***
## as.factor(SIRS_Positive)TRUE           < 2e-16 ***
## age_Ranges(25,35]                     1.91e-06 ***
## age_Ranges(35,45]                      < 2e-16 ***
## age_Ranges(45,55]                      < 2e-16 ***
## age_Ranges(55,65]                      < 2e-16 ***
## age_Ranges(65,75]                      < 2e-16 ***
## age_Ranges(75,85]                      < 2e-16 ***
## age_Ranges(85,100]                     < 2e-16 ***
## gender2Female                          < 2e-16 ***
## gender2Other/Unknown                   < 2e-16 ***
## ethnicity2African American            0.989992    
## ethnicity2Hispanic                    0.000141 ***
## ethnicity2Asian                       0.000146 ***
## ethnicity2Native American             6.58e-16 ***
## ethnicity2Other/Unknown                < 2e-16 ***
## BMI_Ranges(18.5,25]                    < 2e-16 ***
## BMI_Ranges(25,35]                      < 2e-16 ***
## BMI_Ranges(35,200]                     < 2e-16 ***
## BMI_RangesOther/Unknown               0.020619 *  
## icu_admit_source2OR/Proc Area          < 2e-16 ***
## icu_admit_source2Direct Admit          < 2e-16 ***
## icu_admit_source2Emergency Department  < 2e-16 ***
## icu_admit_source2Other                0.022968 *  
## icu_admit_source2Step-Down Unit       1.09e-09 ***
## hospital_teaching_statusf             0.001653 ** 
## hospital_teaching_statust             1.90e-10 ***
## hospital_size<100                      < 2e-16 ***
## hospital_size100-249                  0.955496    
## hospital_size250-500                  3.37e-05 ***
## hospital_size>500                      < 2e-16 ***
## physicianSpeciality2Speciality-Other   < 2e-16 ***
## hospitaldischargeyear2011             0.007066 ** 
## hospitaldischargeyear2012             4.29e-09 ***
## hospitaldischargeyear2013              < 2e-16 ***
## hospitaldischargeyear2014              < 2e-16 ***
## hospitaldischargeyear2015-16           < 2e-16 ***
## dialysis1                              < 2e-16 ***
## aids1                                 1.80e-05 ***
## hepaticfailureTRUE                     < 2e-16 ***
## diabetes1                              < 2e-16 ***
## immunosuppression1                     < 2e-16 ***
## leukemia1                              < 2e-16 ***
## lymphoma1                             9.89e-06 ***
## metastaticcancer1                      < 2e-16 ***
## thrombolytics1                        0.012824 *  
## sofa_respiration_baseline2TRUE        0.017888 *  
## cardiovascular_baseline1               < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 399603  on 638756  degrees of freedom
## Residual deviance: 358142  on 638709  degrees of freedom
## AIC: 358238
## 
## Number of Fisher Scoring iterations: 6
ssd_incl_te$SIRS2ADJHospMortPred <- predict (SIRS2_ADJ_Hosp_Mort_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")

SIRS2ADJMort.Pred <- prediction(ssd_incl_te$SIRS2ADJHospMortPred, ssd_incl_te$hospital_mortality_ultimate)
SIRS2ADJMort.Perf <- performance(SIRS2ADJMort.Pred, "tpr", "fpr")
plot(SIRS2ADJMort.Perf, main = "SIRS Positive Adjusted
     Mortality Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(SIRS2ADJMort.Pred,"auc")@y.values[[1]],3))) 

performance(SIRS2ADJMort.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.7423965
## 
## 
## Slot "alpha.values":
## list()
SIRS2ADJMort.Pred.roc <- roc(hospital_mortality_ultimate~ SIRS2ADJHospMortPred,data=ssd_incl_te)
ci(SIRS2ADJMort.Pred.roc, conf.level=0.99)
## 99% CI: 0.7386-0.7462 (DeLong)
ggplot(calibration(as.factor(hospital_mortality_ultimate==0)~SIRS2ADJHospMortPred, data = ssd_incl_te))+ggtitle("Calibration of ADJ Mortality SIRS Positive Prediction")
## Warning: Removed 2 rows containing missing values (geom_errorbar).

qplot(SIRS2ADJHospMortPred, data = ssd_incl_te)+ggtitle("Histogram of ADJ Mortality SIRS Positive Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

SOFA1_ADJ_Hosp_Mort_tr<-glm(hospital_mortality_ultimate ~ as.factor(SOFA_Change) + age_Ranges + gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + hospital_teaching_status + hospital_size + physicianSpeciality2 + hospitaldischargeyear + dialysis + aids + hepaticfailure  + diabetes + immunosuppression + leukemia + lymphoma + metastaticcancer + thrombolytics + sofa_respiration_baseline2 + cardiovascular_baseline, data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(SOFA1_ADJ_Hosp_Mort_tr)
#sjt.glm(SOFA1_ADJ_Hosp_Mort_tr)

#drop1(SOFA1_ADJ_Hosp_Mort_tr,test="Chisq")

summary(SOFA1_ADJ_Hosp_Mort_tr)
## 
## Call:
## glm(formula = hospital_mortality_ultimate ~ as.factor(SOFA_Change) + 
##     age_Ranges + gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + 
##     hospital_teaching_status + hospital_size + physicianSpeciality2 + 
##     hospitaldischargeyear + dialysis + aids + hepaticfailure + 
##     diabetes + immunosuppression + leukemia + lymphoma + metastaticcancer + 
##     thrombolytics + sofa_respiration_baseline2 + cardiovascular_baseline, 
##     family = "binomial", data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.4428  -0.4058  -0.2414  -0.1429   3.5627  
## 
## Coefficients:
##                                       Estimate Std. Error z value Pr(>|z|)
## (Intercept)                           -4.77549    0.07031 -67.926  < 2e-16
## as.factor(SOFA_Change) 1               0.51755    0.04790  10.806  < 2e-16
## as.factor(SOFA_Change) 2               0.94833    0.04766  19.897  < 2e-16
## as.factor(SOFA_Change) 3               1.50675    0.04653  32.381  < 2e-16
## as.factor(SOFA_Change) 4               1.93885    0.04604  42.111  < 2e-16
## as.factor(SOFA_Change) 5               2.36041    0.04592  51.399  < 2e-16
## as.factor(SOFA_Change) 6               2.59633    0.04636  56.005  < 2e-16
## as.factor(SOFA_Change) 7               3.12266    0.04626  67.496  < 2e-16
## as.factor(SOFA_Change) 8               3.39608    0.04699  72.268  < 2e-16
## as.factor(SOFA_Change) 9               3.72733    0.04787  77.864  < 2e-16
## as.factor(SOFA_Change)10               4.02493    0.04912  81.938  < 2e-16
## as.factor(SOFA_Change)11               4.45056    0.05076  87.686  < 2e-16
## as.factor(SOFA_Change)12               4.70142    0.05401  87.053  < 2e-16
## as.factor(SOFA_Change)13               5.02838    0.05860  85.804  < 2e-16
## as.factor(SOFA_Change)14               5.30110    0.06647  79.756  < 2e-16
## as.factor(SOFA_Change)15               5.59238    0.07855  71.199  < 2e-16
## as.factor(SOFA_Change)16               6.00864    0.09983  60.186  < 2e-16
## as.factor(SOFA_Change)17               6.35174    0.14533  43.706  < 2e-16
## as.factor(SOFA_Change)[18,23]          6.72698    0.15509  43.375  < 2e-16
## age_Ranges(25,35]                      0.15128    0.05287   2.861 0.004220
## age_Ranges(35,45]                      0.25870    0.04883   5.298 1.17e-07
## age_Ranges(45,55]                      0.52916    0.04508  11.738  < 2e-16
## age_Ranges(55,65]                      0.75028    0.04416  16.991  < 2e-16
## age_Ranges(65,75]                      1.02159    0.04396  23.241  < 2e-16
## age_Ranges(75,85]                      1.32943    0.04389  30.289  < 2e-16
## age_Ranges(85,100]                     1.60371    0.04479  35.805  < 2e-16
## gender2Female                          0.07669    0.00984   7.794 6.49e-15
## gender2Other/Unknown                   2.04771    0.20408  10.034  < 2e-16
## ethnicity2African American            -0.16619    0.01631 -10.191  < 2e-16
## ethnicity2Hispanic                    -0.08934    0.02351  -3.800 0.000145
## ethnicity2Asian                       -0.03644    0.04193  -0.869 0.384822
## ethnicity2Native American             -0.06771    0.05532  -1.224 0.220960
## ethnicity2Other/Unknown                0.05483    0.02113   2.595 0.009461
## BMI_Ranges(18.5,25]                   -0.30707    0.02044 -15.020  < 2e-16
## BMI_Ranges(25,35]                     -0.54280    0.02019 -26.879  < 2e-16
## BMI_Ranges(35,200]                    -0.55380    0.02260 -24.501  < 2e-16
## BMI_RangesOther/Unknown                0.08910    0.02987   2.983 0.002858
## icu_admit_source2OR/Proc Area         -1.48921    0.01886 -78.945  < 2e-16
## icu_admit_source2Direct Admit         -0.31881    0.01750 -18.221  < 2e-16
## icu_admit_source2Emergency Department -0.32144    0.01195 -26.897  < 2e-16
## icu_admit_source2Other                -0.10907    0.04515  -2.416 0.015704
## icu_admit_source2Step-Down Unit        0.18099    0.02766   6.544 5.98e-11
## hospital_teaching_statusf              0.17821    0.03549   5.021 5.14e-07
## hospital_teaching_statust              0.05926    0.03605   1.644 0.100152
## hospital_size<100                     -0.34572    0.03910  -8.842  < 2e-16
## hospital_size100-249                  -0.04716    0.02768  -1.704 0.088453
## hospital_size250-500                  -0.04072    0.02799  -1.455 0.145687
## hospital_size>500                      0.13895    0.02617   5.310 1.10e-07
## physicianSpeciality2Speciality-Other  -0.06818    0.01100  -6.198 5.73e-10
## hospitaldischargeyear2011             -0.04850    0.01857  -2.611 0.009015
## hospitaldischargeyear2012             -0.05542    0.01792  -3.093 0.001982
## hospitaldischargeyear2013             -0.05490    0.01758  -3.123 0.001791
## hospitaldischargeyear2014             -0.11714    0.01753  -6.684 2.33e-11
## hospitaldischargeyear2015-16          -0.16845    0.01737  -9.700  < 2e-16
## dialysis1                              0.72138    0.02434  29.635  < 2e-16
## aids1                                  0.39881    0.13002   3.067 0.002160
## hepaticfailureTRUE                     0.38666    0.02700  14.322  < 2e-16
## diabetes1                             -0.25365    0.01263 -20.077  < 2e-16
## immunosuppression1                     0.32414    0.02816  11.509  < 2e-16
## leukemia1                              0.13061    0.04464   2.926 0.003435
## lymphoma1                              0.12959    0.06356   2.039 0.041448
## metastaticcancer1                      0.79487    0.02945  26.992  < 2e-16
## thrombolytics1                         0.23682    0.03927   6.030 1.64e-09
## sofa_respiration_baseline2TRUE         0.41765    0.01111  37.599  < 2e-16
## cardiovascular_baseline1               0.02912    0.01128   2.582 0.009813
##                                          
## (Intercept)                           ***
## as.factor(SOFA_Change) 1              ***
## as.factor(SOFA_Change) 2              ***
## as.factor(SOFA_Change) 3              ***
## as.factor(SOFA_Change) 4              ***
## as.factor(SOFA_Change) 5              ***
## as.factor(SOFA_Change) 6              ***
## as.factor(SOFA_Change) 7              ***
## as.factor(SOFA_Change) 8              ***
## as.factor(SOFA_Change) 9              ***
## as.factor(SOFA_Change)10              ***
## as.factor(SOFA_Change)11              ***
## as.factor(SOFA_Change)12              ***
## as.factor(SOFA_Change)13              ***
## as.factor(SOFA_Change)14              ***
## as.factor(SOFA_Change)15              ***
## as.factor(SOFA_Change)16              ***
## as.factor(SOFA_Change)17              ***
## as.factor(SOFA_Change)[18,23]         ***
## age_Ranges(25,35]                     ** 
## age_Ranges(35,45]                     ***
## age_Ranges(45,55]                     ***
## age_Ranges(55,65]                     ***
## age_Ranges(65,75]                     ***
## age_Ranges(75,85]                     ***
## age_Ranges(85,100]                    ***
## gender2Female                         ***
## gender2Other/Unknown                  ***
## ethnicity2African American            ***
## ethnicity2Hispanic                    ***
## ethnicity2Asian                          
## ethnicity2Native American                
## ethnicity2Other/Unknown               ** 
## BMI_Ranges(18.5,25]                   ***
## BMI_Ranges(25,35]                     ***
## BMI_Ranges(35,200]                    ***
## BMI_RangesOther/Unknown               ** 
## icu_admit_source2OR/Proc Area         ***
## icu_admit_source2Direct Admit         ***
## icu_admit_source2Emergency Department ***
## icu_admit_source2Other                *  
## icu_admit_source2Step-Down Unit       ***
## hospital_teaching_statusf             ***
## hospital_teaching_statust                
## hospital_size<100                     ***
## hospital_size100-249                  .  
## hospital_size250-500                     
## hospital_size>500                     ***
## physicianSpeciality2Speciality-Other  ***
## hospitaldischargeyear2011             ** 
## hospitaldischargeyear2012             ** 
## hospitaldischargeyear2013             ** 
## hospitaldischargeyear2014             ***
## hospitaldischargeyear2015-16          ***
## dialysis1                             ***
## aids1                                 ** 
## hepaticfailureTRUE                    ***
## diabetes1                             ***
## immunosuppression1                    ***
## leukemia1                             ** 
## lymphoma1                             *  
## metastaticcancer1                     ***
## thrombolytics1                        ***
## sofa_respiration_baseline2TRUE        ***
## cardiovascular_baseline1              ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 399603  on 638756  degrees of freedom
## Residual deviance: 298942  on 638692  degrees of freedom
## AIC: 299072
## 
## Number of Fisher Scoring iterations: 7
ssd_incl_te$SOFA1ADJHospMortPred <- predict (SOFA1_ADJ_Hosp_Mort_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")

SOFA1ADJMort.Pred <- prediction(ssd_incl_te$SOFA1ADJHospMortPred, ssd_incl_te$hospital_mortality_ultimate)
SOFA1ADJMort.Perf <- performance(SOFA1ADJMort.Pred, "tpr", "fpr")
plot(SOFA1ADJMort.Perf, main = "SOFA Continuous Adjusted
     Mortality Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(SOFA1ADJMort.Pred,"auc")@y.values[[1]],3))) 

performance(SOFA1ADJMort.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.8472926
## 
## 
## Slot "alpha.values":
## list()
SOFA1ADJMort.Pred.roc <- roc(hospital_mortality_ultimate~ SOFA1ADJHospMortPred,data=ssd_incl_te)
ci(SOFA1ADJMort.Pred.roc, conf.level=0.99)
## 99% CI: 0.8442-0.8504 (DeLong)
ggplot(calibration(as.factor(hospital_mortality_ultimate==0)~SOFA1ADJHospMortPred, data = ssd_incl_te))+ggtitle("Calibration of ADJ Mortality SOFA Total Prediction")

qplot(SOFA1ADJHospMortPred, data = ssd_incl_te)+ggtitle("Histogram of ADJ Mortality SOFA Total Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

SOFA2_ADJ_Hosp_Mort_tr<-glm(hospital_mortality_ultimate ~ as.factor(SOFA_Positive) + age_Ranges + gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + hospital_teaching_status + hospital_size + physicianSpeciality2 + hospitaldischargeyear + dialysis + aids + hepaticfailure  + diabetes + immunosuppression + leukemia + lymphoma + metastaticcancer + thrombolytics + sofa_respiration_baseline2 + cardiovascular_baseline, data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(SOFA2_ADJ_Hosp_Mort_tr)
#sjt.glm(SOFA2_ADJ_Hosp_Mort_tr)

#drop1(SOFA2_ADJ_Hosp_Mort_tr,test="Chisq")

summary(SOFA2_ADJ_Hosp_Mort_tr)
## 
## Call:
## glm(formula = hospital_mortality_ultimate ~ as.factor(SOFA_Positive) + 
##     age_Ranges + gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + 
##     hospital_teaching_status + hospital_size + physicianSpeciality2 + 
##     hospitaldischargeyear + dialysis + aids + hepaticfailure + 
##     diabetes + immunosuppression + leukemia + lymphoma + metastaticcancer + 
##     thrombolytics + sofa_respiration_baseline2 + cardiovascular_baseline, 
##     family = "binomial", data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.8380  -0.5240  -0.3328  -0.1673   3.4801  
## 
## Coefficients:
##                                        Estimate Std. Error z value
## (Intercept)                           -3.978119   0.053948 -73.740
## as.factor(SOFA_Positive)TRUE           2.020614   0.018376 109.959
## age_Ranges(25,35]                      0.215132   0.049528   4.344
## age_Ranges(35,45]                      0.395554   0.045716   8.652
## age_Ranges(45,55]                      0.689357   0.042315  16.291
## age_Ranges(55,65]                      0.916742   0.041492  22.095
## age_Ranges(65,75]                      1.130514   0.041313  27.365
## age_Ranges(75,85]                      1.369151   0.041246  33.195
## age_Ranges(85,100]                     1.562525   0.042060  37.150
## gender2Female                         -0.019092   0.009065  -2.106
## gender2Other/Unknown                   1.934512   0.186694  10.362
## ethnicity2African American            -0.033650   0.014909  -2.257
## ethnicity2Hispanic                     0.047706   0.021550   2.214
## ethnicity2Asian                        0.094731   0.038058   2.489
## ethnicity2Native American              0.294545   0.049580   5.941
## ethnicity2Other/Unknown                0.174577   0.019311   9.040
## BMI_Ranges(18.5,25]                   -0.313238   0.018909 -16.566
## BMI_Ranges(25,35]                     -0.477467   0.018647 -25.605
## BMI_Ranges(35,200]                    -0.389262   0.020822 -18.695
## BMI_RangesOther/Unknown                0.031327   0.027394   1.144
## icu_admit_source2OR/Proc Area         -1.449279   0.017681 -81.968
## icu_admit_source2Direct Admit         -0.311429   0.015879 -19.613
## icu_admit_source2Emergency Department -0.424613   0.010937 -38.825
## icu_admit_source2Other                -0.085987   0.041144  -2.090
## icu_admit_source2Step-Down Unit        0.146360   0.025244   5.798
## hospital_teaching_statusf             -0.037912   0.032651  -1.161
## hospital_teaching_statust             -0.152785   0.033018  -4.627
## hospital_size<100                     -0.492326   0.036909 -13.339
## hospital_size100-249                  -0.032021   0.025680  -1.247
## hospital_size250-500                   0.069264   0.025923   2.672
## hospital_size>500                      0.215502   0.024158   8.920
## physicianSpeciality2Speciality-Other  -0.302475   0.010021 -30.183
## hospitaldischargeyear2011             -0.034288   0.017083  -2.007
## hospitaldischargeyear2012             -0.063331   0.016481  -3.843
## hospitaldischargeyear2013             -0.091968   0.016212  -5.673
## hospitaldischargeyear2014             -0.136227   0.016154  -8.433
## hospitaldischargeyear2015-16          -0.122819   0.015973  -7.689
## dialysis1                              0.417044   0.022762  18.322
## aids1                                  0.475890   0.118844   4.004
## hepaticfailureTRUE                     0.558113   0.024573  22.713
## diabetes1                             -0.308962   0.011711 -26.381
## immunosuppression1                     0.344634   0.025615  13.454
## leukemia1                              0.393989   0.040016   9.846
## lymphoma1                              0.247094   0.057337   4.310
## metastaticcancer1                      0.684668   0.026839  25.510
## thrombolytics1                         0.243885   0.035466   6.877
## sofa_respiration_baseline2TRUE         0.115258   0.010233  11.263
## cardiovascular_baseline1               0.057819   0.010430   5.544
##                                       Pr(>|z|)    
## (Intercept)                            < 2e-16 ***
## as.factor(SOFA_Positive)TRUE           < 2e-16 ***
## age_Ranges(25,35]                     1.40e-05 ***
## age_Ranges(35,45]                      < 2e-16 ***
## age_Ranges(45,55]                      < 2e-16 ***
## age_Ranges(55,65]                      < 2e-16 ***
## age_Ranges(65,75]                      < 2e-16 ***
## age_Ranges(75,85]                      < 2e-16 ***
## age_Ranges(85,100]                     < 2e-16 ***
## gender2Female                         0.035194 *  
## gender2Other/Unknown                   < 2e-16 ***
## ethnicity2African American            0.024005 *  
## ethnicity2Hispanic                    0.026843 *  
## ethnicity2Asian                       0.012805 *  
## ethnicity2Native American             2.84e-09 ***
## ethnicity2Other/Unknown                < 2e-16 ***
## BMI_Ranges(18.5,25]                    < 2e-16 ***
## BMI_Ranges(25,35]                      < 2e-16 ***
## BMI_Ranges(35,200]                     < 2e-16 ***
## BMI_RangesOther/Unknown               0.252815    
## icu_admit_source2OR/Proc Area          < 2e-16 ***
## icu_admit_source2Direct Admit          < 2e-16 ***
## icu_admit_source2Emergency Department  < 2e-16 ***
## icu_admit_source2Other                0.036629 *  
## icu_admit_source2Step-Down Unit       6.72e-09 ***
## hospital_teaching_statusf             0.245594    
## hospital_teaching_statust             3.70e-06 ***
## hospital_size<100                      < 2e-16 ***
## hospital_size100-249                  0.212422    
## hospital_size250-500                  0.007543 ** 
## hospital_size>500                      < 2e-16 ***
## physicianSpeciality2Speciality-Other   < 2e-16 ***
## hospitaldischargeyear2011             0.044739 *  
## hospitaldischargeyear2012             0.000122 ***
## hospitaldischargeyear2013             1.41e-08 ***
## hospitaldischargeyear2014              < 2e-16 ***
## hospitaldischargeyear2015-16          1.48e-14 ***
## dialysis1                              < 2e-16 ***
## aids1                                 6.22e-05 ***
## hepaticfailureTRUE                     < 2e-16 ***
## diabetes1                              < 2e-16 ***
## immunosuppression1                     < 2e-16 ***
## leukemia1                              < 2e-16 ***
## lymphoma1                             1.64e-05 ***
## metastaticcancer1                      < 2e-16 ***
## thrombolytics1                        6.13e-12 ***
## sofa_respiration_baseline2TRUE         < 2e-16 ***
## cardiovascular_baseline1              2.96e-08 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 399603  on 638756  degrees of freedom
## Residual deviance: 350403  on 638709  degrees of freedom
## AIC: 350499
## 
## Number of Fisher Scoring iterations: 6
ssd_incl_te$SOFA2ADJHospMortPred <- predict(SOFA2_ADJ_Hosp_Mort_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")

SOFA2ADJMort.Pred <- prediction(ssd_incl_te$SOFA2ADJHospMortPred, ssd_incl_te$hospital_mortality_ultimate)
SOFA2ADJMort.Perf <- performance(SOFA2ADJMort.Pred, "tpr", "fpr")
plot(SOFA2ADJMort.Perf, main = "SOFA Positive Adjusted
     Mortality Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(SOFA2ADJMort.Pred,"auc")@y.values[[1]],3))) 

performance(SOFA2ADJMort.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.7592311
## 
## 
## Slot "alpha.values":
## list()
SOFA2ADJMort.Pred.roc <- roc(hospital_mortality_ultimate~ SOFA2ADJHospMortPred,data=ssd_incl_te)
ci(SOFA2ADJMort.Pred.roc, conf.level=0.99)
## 99% CI: 0.7557-0.7627 (DeLong)
ggplot(calibration(as.factor(hospital_mortality_ultimate==0)~SOFA2ADJHospMortPred, data = ssd_incl_te))+ggtitle("Calibration of ADJ Mortality SOFA Positive Prediction")
## Warning: Removed 2 rows containing missing values (geom_errorbar).

qplot(SOFA2ADJHospMortPred, data = ssd_incl_te)+ggtitle("Histogram of ADJ Mortality SOFA Positive Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

SOFA score positive without baseline SOFA

SOFA3_ADJ_Hosp_Mort_tr<-glm(hospital_mortality_ultimate ~ as.factor(SOFA_Positive2) + age_Ranges + gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + hospital_teaching_status + hospital_size + physicianSpeciality2 + hospitaldischargeyear + dialysis + aids + hepaticfailure  + diabetes + immunosuppression + leukemia + lymphoma + metastaticcancer + thrombolytics + sofa_respiration_baseline2 + cardiovascular_baseline, data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(SOFA3_ADJ_Hosp_Mort_tr)
#sjt.glm(SOFA3_ADJ_Hosp_Mort_tr)

#drop1(SOFA3_ADJ_Hosp_Mort_tr,test="Chisq")

summary(SOFA3_ADJ_Hosp_Mort_tr)
## 
## Call:
## glm(formula = hospital_mortality_ultimate ~ as.factor(SOFA_Positive2) + 
##     age_Ranges + gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + 
##     hospital_teaching_status + hospital_size + physicianSpeciality2 + 
##     hospitaldischargeyear + dialysis + aids + hepaticfailure + 
##     diabetes + immunosuppression + leukemia + lymphoma + metastaticcancer + 
##     thrombolytics + sofa_respiration_baseline2 + cardiovascular_baseline, 
##     family = "binomial", data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.8265  -0.5241  -0.3413  -0.1648   3.4979  
## 
## Coefficients:
##                                        Estimate Std. Error z value
## (Intercept)                           -4.022666   0.054342 -74.025
## as.factor(SOFA_Positive2)TRUE          2.070136   0.019691 105.128
## age_Ranges(25,35]                      0.206791   0.049510   4.177
## age_Ranges(35,45]                      0.386802   0.045701   8.464
## age_Ranges(45,55]                      0.685480   0.042302  16.205
## age_Ranges(55,65]                      0.915737   0.041479  22.077
## age_Ranges(65,75]                      1.133289   0.041300  27.440
## age_Ranges(75,85]                      1.375282   0.041235  33.352
## age_Ranges(85,100]                     1.571159   0.042050  37.364
## gender2Female                         -0.022891   0.009053  -2.529
## gender2Other/Unknown                   1.909668   0.186607  10.234
## ethnicity2African American            -0.037713   0.014880  -2.535
## ethnicity2Hispanic                     0.039776   0.021506   1.850
## ethnicity2Asian                        0.096467   0.037981   2.540
## ethnicity2Native American              0.307064   0.049439   6.211
## ethnicity2Other/Unknown                0.173564   0.019283   9.001
## BMI_Ranges(18.5,25]                   -0.314244   0.018874 -16.650
## BMI_Ranges(25,35]                     -0.477045   0.018613 -25.629
## BMI_Ranges(35,200]                    -0.390237   0.020781 -18.778
## BMI_RangesOther/Unknown                0.028400   0.027349   1.038
## icu_admit_source2OR/Proc Area         -1.445876   0.017671 -81.821
## icu_admit_source2Direct Admit         -0.311644   0.015853 -19.658
## icu_admit_source2Emergency Department -0.425477   0.010916 -38.977
## icu_admit_source2Other                -0.076304   0.041097  -1.857
## icu_admit_source2Step-Down Unit        0.150637   0.025189   5.980
## hospital_teaching_statusf             -0.039567   0.032606  -1.213
## hospital_teaching_statust             -0.151906   0.032980  -4.606
## hospital_size<100                     -0.498093   0.036872 -13.509
## hospital_size100-249                  -0.035545   0.025642  -1.386
## hospital_size250-500                   0.071683   0.025888   2.769
## hospital_size>500                      0.214426   0.024128   8.887
## physicianSpeciality2Speciality-Other  -0.301722   0.010010 -30.142
## hospitaldischargeyear2011             -0.034558   0.017062  -2.025
## hospitaldischargeyear2012             -0.064082   0.016461  -3.893
## hospitaldischargeyear2013             -0.096544   0.016190  -5.963
## hospitaldischargeyear2014             -0.139689   0.016131  -8.660
## hospitaldischargeyear2015-16          -0.126314   0.015951  -7.919
## dialysis1                              0.094191   0.022225   4.238
## aids1                                  0.495812   0.118478   4.185
## hepaticfailureTRUE                     0.553304   0.024479  22.603
## diabetes1                             -0.305693   0.011685 -26.162
## immunosuppression1                     0.340377   0.025563  13.315
## leukemia1                              0.405643   0.039939  10.156
## lymphoma1                              0.252952   0.057272   4.417
## metastaticcancer1                      0.684713   0.026800  25.549
## thrombolytics1                         0.250331   0.035468   7.058
## sofa_respiration_baseline2TRUE         0.075186   0.010211   7.363
## cardiovascular_baseline1               0.058011   0.010409   5.573
##                                       Pr(>|z|)    
## (Intercept)                            < 2e-16 ***
## as.factor(SOFA_Positive2)TRUE          < 2e-16 ***
## age_Ranges(25,35]                     2.96e-05 ***
## age_Ranges(35,45]                      < 2e-16 ***
## age_Ranges(45,55]                      < 2e-16 ***
## age_Ranges(55,65]                      < 2e-16 ***
## age_Ranges(65,75]                      < 2e-16 ***
## age_Ranges(75,85]                      < 2e-16 ***
## age_Ranges(85,100]                     < 2e-16 ***
## gender2Female                          0.01145 *  
## gender2Other/Unknown                   < 2e-16 ***
## ethnicity2African American             0.01126 *  
## ethnicity2Hispanic                     0.06438 .  
## ethnicity2Asian                        0.01109 *  
## ethnicity2Native American             5.27e-10 ***
## ethnicity2Other/Unknown                < 2e-16 ***
## BMI_Ranges(18.5,25]                    < 2e-16 ***
## BMI_Ranges(25,35]                      < 2e-16 ***
## BMI_Ranges(35,200]                     < 2e-16 ***
## BMI_RangesOther/Unknown                0.29908    
## icu_admit_source2OR/Proc Area          < 2e-16 ***
## icu_admit_source2Direct Admit          < 2e-16 ***
## icu_admit_source2Emergency Department  < 2e-16 ***
## icu_admit_source2Other                 0.06336 .  
## icu_admit_source2Step-Down Unit       2.23e-09 ***
## hospital_teaching_statusf              0.22494    
## hospital_teaching_statust             4.10e-06 ***
## hospital_size<100                      < 2e-16 ***
## hospital_size100-249                   0.16568    
## hospital_size250-500                   0.00562 ** 
## hospital_size>500                      < 2e-16 ***
## physicianSpeciality2Speciality-Other   < 2e-16 ***
## hospitaldischargeyear2011              0.04282 *  
## hospitaldischargeyear2012             9.90e-05 ***
## hospitaldischargeyear2013             2.47e-09 ***
## hospitaldischargeyear2014              < 2e-16 ***
## hospitaldischargeyear2015-16          2.39e-15 ***
## dialysis1                             2.25e-05 ***
## aids1                                 2.85e-05 ***
## hepaticfailureTRUE                     < 2e-16 ***
## diabetes1                              < 2e-16 ***
## immunosuppression1                     < 2e-16 ***
## leukemia1                              < 2e-16 ***
## lymphoma1                             1.00e-05 ***
## metastaticcancer1                      < 2e-16 ***
## thrombolytics1                        1.69e-12 ***
## sofa_respiration_baseline2TRUE        1.80e-13 ***
## cardiovascular_baseline1              2.50e-08 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 399603  on 638756  degrees of freedom
## Residual deviance: 351548  on 638709  degrees of freedom
## AIC: 351644
## 
## Number of Fisher Scoring iterations: 7
ssd_incl_te$SOFA3ADJHospMortPred <- predict(SOFA3_ADJ_Hosp_Mort_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")

SOFA3ADJMort.Pred <- prediction(ssd_incl_te$SOFA3ADJHospMortPred, ssd_incl_te$hospital_mortality_ultimate)
SOFA3ADJMort.Perf <- performance(SOFA3ADJMort.Pred, "tpr", "fpr")
plot(SOFA3ADJMort.Perf, main = "SOFA Positive w/o Baseline Adjusted 
     Mortality Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(SOFA3ADJMort.Pred,"auc")@y.values[[1]],3))) 

performance(SOFA3ADJMort.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.7562943
## 
## 
## Slot "alpha.values":
## list()
SOFA3ADJMort.Pred.roc <- roc(hospital_mortality_ultimate~ SOFA3ADJHospMortPred,data=ssd_incl_te)
ci(SOFA3ADJMort.Pred.roc, conf.level=0.99)
## 99% CI: 0.7528-0.7598 (DeLong)
ggplot(calibration(as.factor(hospital_mortality_ultimate==0)~SOFA3ADJHospMortPred, data = ssd_incl_te))+ggtitle("Calibration of ADJ Mortality SOFA Positive w/o Baseline Prediction")
## Warning: Removed 2 rows containing missing values (geom_errorbar).

qplot(SOFA3ADJHospMortPred, data = ssd_incl_te)+ggtitle("Histogram of ADJ Mortality SOFA Positive w/o Baseline Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

qSOFA1_ADJ_Hosp_Mort_tr<-glm(hospital_mortality_ultimate ~ as.factor(qSOFA_total) + age_Ranges + gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + hospital_teaching_status + hospital_size + physicianSpeciality2 + hospitaldischargeyear + dialysis + aids + hepaticfailure  + diabetes + immunosuppression + leukemia + lymphoma + metastaticcancer + thrombolytics + sofa_respiration_baseline2 + cardiovascular_baseline, data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(qSOFA1_ADJ_Hosp_Mort_tr)
#sjt.glm(qSOFA1_ADJ_Hosp_Mort_tr)

#drop1(qSOFA1_ADJ_Hosp_Mort_tr,test="Chisq")

summary(qSOFA1_ADJ_Hosp_Mort_tr)
## 
## Call:
## glm(formula = hospital_mortality_ultimate ~ as.factor(qSOFA_total) + 
##     age_Ranges + gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + 
##     hospital_teaching_status + hospital_size + physicianSpeciality2 + 
##     hospitaldischargeyear + dialysis + aids + hepaticfailure + 
##     diabetes + immunosuppression + leukemia + lymphoma + metastaticcancer + 
##     thrombolytics + sofa_respiration_baseline2 + cardiovascular_baseline, 
##     family = "binomial", data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.0781  -0.4725  -0.3128  -0.1937   3.5246  
## 
## Coefficients:
##                                       Estimate Std. Error z value Pr(>|z|)
## (Intercept)                           -4.48635    0.06848 -65.509  < 2e-16
## as.factor(qSOFA_total)1                1.00808    0.04734  21.293  < 2e-16
## as.factor(qSOFA_total)2                1.94445    0.04577  42.483  < 2e-16
## as.factor(qSOFA_total)3                2.95871    0.04575  64.676  < 2e-16
## age_Ranges(25,35]                      0.24743    0.04965   4.984 6.24e-07
## age_Ranges(35,45]                      0.42222    0.04584   9.210  < 2e-16
## age_Ranges(45,55]                      0.73252    0.04242  17.267  < 2e-16
## age_Ranges(55,65]                      0.98791    0.04159  23.752  < 2e-16
## age_Ranges(65,75]                      1.22975    0.04141  29.698  < 2e-16
## age_Ranges(75,85]                      1.49355    0.04134  36.125  < 2e-16
## age_Ranges(85,100]                     1.66198    0.04219  39.393  < 2e-16
## gender2Female                         -0.09968    0.00918 -10.858  < 2e-16
## gender2Other/Unknown                   1.85305    0.18824   9.844  < 2e-16
## ethnicity2African American             0.03574    0.01514   2.360 0.018255
## ethnicity2Hispanic                     0.11388    0.02188   5.205 1.94e-07
## ethnicity2Asian                        0.14790    0.03872   3.820 0.000134
## ethnicity2Native American              0.31628    0.05041   6.274 3.51e-10
## ethnicity2Other/Unknown                0.23091    0.01960  11.781  < 2e-16
## BMI_Ranges(18.5,25]                   -0.25980    0.01918 -13.548  < 2e-16
## BMI_Ranges(25,35]                     -0.37658    0.01892 -19.909  < 2e-16
## BMI_Ranges(35,200]                    -0.26780    0.02112 -12.680  < 2e-16
## BMI_RangesOther/Unknown                0.11647    0.02776   4.196 2.72e-05
## icu_admit_source2OR/Proc Area         -1.36067    0.01785 -76.233  < 2e-16
## icu_admit_source2Direct Admit         -0.24365    0.01612 -15.119  < 2e-16
## icu_admit_source2Emergency Department -0.39992    0.01111 -35.980  < 2e-16
## icu_admit_source2Other                -0.10582    0.04178  -2.533 0.011308
## icu_admit_source2Step-Down Unit        0.14124    0.02571   5.493 3.94e-08
## hospital_teaching_statusf             -0.22706    0.03302  -6.878 6.09e-12
## hospital_teaching_statust             -0.35201    0.03319 -10.606  < 2e-16
## hospital_size<100                     -0.25685    0.03725  -6.896 5.35e-12
## hospital_size100-249                   0.18021    0.02594   6.948 3.70e-12
## hospital_size250-500                   0.25599    0.02618   9.778  < 2e-16
## hospital_size>500                      0.38362    0.02426  15.814  < 2e-16
## physicianSpeciality2Speciality-Other  -0.25256    0.01014 -24.904  < 2e-16
## hospitaldischargeyear2011             -0.08942    0.01737  -5.147 2.65e-07
## hospitaldischargeyear2012             -0.16375    0.01675  -9.777  < 2e-16
## hospitaldischargeyear2013             -0.20339    0.01646 -12.355  < 2e-16
## hospitaldischargeyear2014             -0.23849    0.01640 -14.542  < 2e-16
## hospitaldischargeyear2015-16          -0.24052    0.01622 -14.824  < 2e-16
## dialysis1                              0.30372    0.02307  13.166  < 2e-16
## aids1                                  0.47169    0.12083   3.904 9.47e-05
## hepaticfailureTRUE                     0.66597    0.02526  26.366  < 2e-16
## diabetes1                             -0.26099    0.01188 -21.968  < 2e-16
## immunosuppression1                     0.42742    0.02603  16.422  < 2e-16
## leukemia1                              0.51659    0.04108  12.575  < 2e-16
## lymphoma1                              0.29826    0.05838   5.109 3.24e-07
## metastaticcancer1                      0.70288    0.02718  25.858  < 2e-16
## thrombolytics1                         0.15957    0.03535   4.514 6.35e-06
## sofa_respiration_baseline2TRUE         0.02806    0.01036   2.708 0.006764
## cardiovascular_baseline1               0.11607    0.01059  10.961  < 2e-16
##                                          
## (Intercept)                           ***
## as.factor(qSOFA_total)1               ***
## as.factor(qSOFA_total)2               ***
## as.factor(qSOFA_total)3               ***
## age_Ranges(25,35]                     ***
## age_Ranges(35,45]                     ***
## age_Ranges(45,55]                     ***
## age_Ranges(55,65]                     ***
## age_Ranges(65,75]                     ***
## age_Ranges(75,85]                     ***
## age_Ranges(85,100]                    ***
## gender2Female                         ***
## gender2Other/Unknown                  ***
## ethnicity2African American            *  
## ethnicity2Hispanic                    ***
## ethnicity2Asian                       ***
## ethnicity2Native American             ***
## ethnicity2Other/Unknown               ***
## BMI_Ranges(18.5,25]                   ***
## BMI_Ranges(25,35]                     ***
## BMI_Ranges(35,200]                    ***
## BMI_RangesOther/Unknown               ***
## icu_admit_source2OR/Proc Area         ***
## icu_admit_source2Direct Admit         ***
## icu_admit_source2Emergency Department ***
## icu_admit_source2Other                *  
## icu_admit_source2Step-Down Unit       ***
## hospital_teaching_statusf             ***
## hospital_teaching_statust             ***
## hospital_size<100                     ***
## hospital_size100-249                  ***
## hospital_size250-500                  ***
## hospital_size>500                     ***
## physicianSpeciality2Speciality-Other  ***
## hospitaldischargeyear2011             ***
## hospitaldischargeyear2012             ***
## hospitaldischargeyear2013             ***
## hospitaldischargeyear2014             ***
## hospitaldischargeyear2015-16          ***
## dialysis1                             ***
## aids1                                 ***
## hepaticfailureTRUE                    ***
## diabetes1                             ***
## immunosuppression1                    ***
## leukemia1                             ***
## lymphoma1                             ***
## metastaticcancer1                     ***
## thrombolytics1                        ***
## sofa_respiration_baseline2TRUE        ** 
## cardiovascular_baseline1              ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 399603  on 638756  degrees of freedom
## Residual deviance: 343488  on 638707  degrees of freedom
## AIC: 343588
## 
## Number of Fisher Scoring iterations: 7
ssd_incl_te$qSOFA1ADJHospMortPred <- predict(qSOFA1_ADJ_Hosp_Mort_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")
library(sjPlot)
library(ROCR)

qSOFA1ADJMort.Pred <- prediction(ssd_incl_te$qSOFA1ADJHospMortPred, ssd_incl_te$hospital_mortality_ultimate)
qSOFA1ADJMort.Perf <- performance(qSOFA1ADJMort.Pred, "tpr", "fpr")
plot(qSOFA1ADJMort.Perf, main = "qSOFA1 Continuous Adjusted
     Mortality Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(qSOFA1ADJMort.Pred,"auc")@y.values[[1]],3))) 

performance(qSOFA1ADJMort.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.7777231
## 
## 
## Slot "alpha.values":
## list()
qSOFA1ADJMort.Pred.roc <- roc(hospital_mortality_ultimate~ qSOFA1ADJHospMortPred,data=ssd_incl_te)
ci(qSOFA1ADJMort.Pred.roc, conf.level=0.99)
## 99% CI: 0.7741-0.7814 (DeLong)
ggplot(calibration(as.factor(hospital_mortality_ultimate==0)~qSOFA1ADJHospMortPred, data = ssd_incl_te))+ggtitle("Calibration of ADJ Mortality qSOFA Total Prediction")
## Warning: Removed 1 rows containing missing values (geom_errorbar).

qplot(qSOFA1ADJHospMortPred, data = ssd_incl_te)+ggtitle("Histogram of ADJ Mortality qSOFA Total Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

qSOFA2_ADJ_Hosp_Mort_tr<-glm(hospital_mortality_ultimate ~ as.factor(qSOFA_Positive) + age_Ranges + gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + hospital_teaching_status + hospital_size + physicianSpeciality2 + hospitaldischargeyear + dialysis + aids + hepaticfailure  + diabetes + immunosuppression + leukemia + lymphoma + metastaticcancer + thrombolytics + sofa_respiration_baseline2 + cardiovascular_baseline, data=ssd_incl_tr,family="binomial",na.action = na.omit)
 
#sjp.glm(qSOFA2_ADJ_Hosp_Mort_tr)
#sjt.glm(qSOFA2_ADJ_Hosp_Mort_tr)

#drop1(qSOFA2_ADJ_Hosp_Mort_tr,test="Chisq")

summary(qSOFA2_ADJ_Hosp_Mort_tr)
## 
## Call:
## glm(formula = hospital_mortality_ultimate ~ as.factor(qSOFA_Positive) + 
##     age_Ranges + gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + 
##     hospital_teaching_status + hospital_size + physicianSpeciality2 + 
##     hospitaldischargeyear + dialysis + aids + hepaticfailure + 
##     diabetes + immunosuppression + leukemia + lymphoma + metastaticcancer + 
##     thrombolytics + sofa_respiration_baseline2 + cardiovascular_baseline, 
##     family = "binomial", data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.8052  -0.5088  -0.3339  -0.2045   3.4565  
## 
## Coefficients:
##                                        Estimate Std. Error z value
## (Intercept)                           -3.508901   0.052607 -66.701
## as.factor(qSOFA_Positive)TRUE          1.525327   0.014401 105.917
## age_Ranges(25,35]                      0.241662   0.049333   4.899
## age_Ranges(35,45]                      0.420857   0.045539   9.242
## age_Ranges(45,55]                      0.737753   0.042141  17.507
## age_Ranges(55,65]                      1.000275   0.041316  24.211
## age_Ranges(65,75]                      1.244254   0.041131  30.251
## age_Ranges(75,85]                      1.521611   0.041065  37.054
## age_Ranges(85,100]                     1.730355   0.041881  41.316
## gender2Female                         -0.093649   0.009044 -10.354
## gender2Other/Unknown                   1.843265   0.184148  10.010
## ethnicity2African American             0.038999   0.014918   2.614
## ethnicity2Hispanic                     0.106499   0.021534   4.946
## ethnicity2Asian                        0.137830   0.038050   3.622
## ethnicity2Native American              0.367605   0.049623   7.408
## ethnicity2Other/Unknown                0.230829   0.019291  11.966
## BMI_Ranges(18.5,25]                   -0.291869   0.018827 -15.502
## BMI_Ranges(25,35]                     -0.432094   0.018573 -23.265
## BMI_Ranges(35,200]                    -0.312671   0.020749 -15.069
## BMI_RangesOther/Unknown                0.048488   0.027255   1.779
## icu_admit_source2OR/Proc Area         -1.412684   0.017669 -79.954
## icu_admit_source2Direct Admit         -0.302155   0.015838 -19.078
## icu_admit_source2Emergency Department -0.435392   0.010916 -39.887
## icu_admit_source2Other                -0.093011   0.041049  -2.266
## icu_admit_source2Step-Down Unit        0.148979   0.025197   5.913
## hospital_teaching_statusf             -0.211453   0.032528  -6.501
## hospital_teaching_statust             -0.325831   0.032722  -9.957
## hospital_size<100                     -0.347279   0.036784  -9.441
## hospital_size100-249                   0.120466   0.025548   4.715
## hospital_size250-500                   0.237521   0.025803   9.205
## hospital_size>500                      0.364198   0.023914  15.229
## physicianSpeciality2Speciality-Other  -0.330597   0.009956 -33.206
## hospitaldischargeyear2011             -0.072053   0.017091  -4.216
## hospitaldischargeyear2012             -0.140386   0.016480  -8.519
## hospitaldischargeyear2013             -0.195734   0.016207 -12.077
## hospitaldischargeyear2014             -0.230626   0.016150 -14.281
## hospitaldischargeyear2015-16          -0.210284   0.015972 -13.166
## dialysis1                              0.324834   0.022633  14.352
## aids1                                  0.479190   0.118795   4.034
## hepaticfailureTRUE                     0.705191   0.024767  28.473
## diabetes1                             -0.262420   0.011702 -22.426
## immunosuppression1                     0.381358   0.025520  14.943
## leukemia1                              0.491629   0.040230  12.220
## lymphoma1                              0.275756   0.057416   4.803
## metastaticcancer1                      0.680467   0.026658  25.526
## thrombolytics1                         0.054774   0.034907   1.569
## sofa_respiration_baseline2TRUE         0.049611   0.010198   4.865
## cardiovascular_baseline1               0.098528   0.010413   9.462
##                                       Pr(>|z|)    
## (Intercept)                            < 2e-16 ***
## as.factor(qSOFA_Positive)TRUE          < 2e-16 ***
## age_Ranges(25,35]                     9.65e-07 ***
## age_Ranges(35,45]                      < 2e-16 ***
## age_Ranges(45,55]                      < 2e-16 ***
## age_Ranges(55,65]                      < 2e-16 ***
## age_Ranges(65,75]                      < 2e-16 ***
## age_Ranges(75,85]                      < 2e-16 ***
## age_Ranges(85,100]                     < 2e-16 ***
## gender2Female                          < 2e-16 ***
## gender2Other/Unknown                   < 2e-16 ***
## ethnicity2African American            0.008944 ** 
## ethnicity2Hispanic                    7.59e-07 ***
## ethnicity2Asian                       0.000292 ***
## ethnicity2Native American             1.28e-13 ***
## ethnicity2Other/Unknown                < 2e-16 ***
## BMI_Ranges(18.5,25]                    < 2e-16 ***
## BMI_Ranges(25,35]                      < 2e-16 ***
## BMI_Ranges(35,200]                     < 2e-16 ***
## BMI_RangesOther/Unknown               0.075230 .  
## icu_admit_source2OR/Proc Area          < 2e-16 ***
## icu_admit_source2Direct Admit          < 2e-16 ***
## icu_admit_source2Emergency Department  < 2e-16 ***
## icu_admit_source2Other                0.023460 *  
## icu_admit_source2Step-Down Unit       3.37e-09 ***
## hospital_teaching_statusf             8.00e-11 ***
## hospital_teaching_statust              < 2e-16 ***
## hospital_size<100                      < 2e-16 ***
## hospital_size100-249                  2.41e-06 ***
## hospital_size250-500                   < 2e-16 ***
## hospital_size>500                      < 2e-16 ***
## physicianSpeciality2Speciality-Other   < 2e-16 ***
## hospitaldischargeyear2011             2.49e-05 ***
## hospitaldischargeyear2012              < 2e-16 ***
## hospitaldischargeyear2013              < 2e-16 ***
## hospitaldischargeyear2014              < 2e-16 ***
## hospitaldischargeyear2015-16           < 2e-16 ***
## dialysis1                              < 2e-16 ***
## aids1                                 5.49e-05 ***
## hepaticfailureTRUE                     < 2e-16 ***
## diabetes1                              < 2e-16 ***
## immunosuppression1                     < 2e-16 ***
## leukemia1                              < 2e-16 ***
## lymphoma1                             1.57e-06 ***
## metastaticcancer1                      < 2e-16 ***
## thrombolytics1                        0.116617    
## sofa_respiration_baseline2TRUE        1.15e-06 ***
## cardiovascular_baseline1               < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 399603  on 638756  degrees of freedom
## Residual deviance: 355239  on 638709  degrees of freedom
## AIC: 355335
## 
## Number of Fisher Scoring iterations: 6
ssd_incl_te$qSOFA2ADJHospMortPred <- predict(qSOFA2_ADJ_Hosp_Mort_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")
library(sjPlot)
library(ROCR)

qSOFA2ADJMort.Pred <- prediction(ssd_incl_te$qSOFA2ADJHospMortPred, ssd_incl_te$hospital_mortality_ultimate)
qSOFA2ADJMort.Perf <- performance(qSOFA2ADJMort.Pred, "tpr", "fpr")
plot(qSOFA2ADJMort.Perf, main = "qSOFA Positive Adjusted
     Mortality Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(qSOFA2ADJMort.Pred,"auc")@y.values[[1]],3))) 

performance(qSOFA2ADJMort.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.7505584
## 
## 
## Slot "alpha.values":
## list()
qSOFA2ADJMort.Pred.roc <- roc(hospital_mortality_ultimate~ qSOFA2ADJHospMortPred,data=ssd_incl_te)
ci(qSOFA2ADJMort.Pred.roc, conf.level=0.99)
## 99% CI: 0.7468-0.7543 (DeLong)
ggplot(calibration(as.factor(hospital_mortality_ultimate==0)~qSOFA2ADJHospMortPred, data = ssd_incl_te))+ggtitle("Calibration of ADJ Mortality qSOFA Positive Prediction")
## Warning: Removed 2 rows containing missing values (geom_errorbar).

qplot(qSOFA2ADJHospMortPred, data = ssd_incl_te)+ggtitle("Histogram of ADJ Mortality qSOFA Positive Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

FuzzyLogic_ADJ_Hosp_Mort_tr<-glm(hospital_mortality_ultimate ~ as.factor(SepsisFuzzyLogicPositive) + age_Ranges + gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + hospital_teaching_status + hospital_size + physicianSpeciality2 + hospitaldischargeyear + dialysis + aids + hepaticfailure  + diabetes + immunosuppression + leukemia + lymphoma + metastaticcancer + thrombolytics + sofa_respiration_baseline2 + cardiovascular_baseline, data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(FuzzyLogic_ADJ_Hosp_Mort_tr)
#sjt.glm(FuzzyLogic_ADJ_Hosp_Mort_tr)

#drop1(FuzzyLogic_ADJ_Hosp_Mort_tr,test="Chisq")

summary(FuzzyLogic_ADJ_Hosp_Mort_tr)
## 
## Call:
## glm(formula = hospital_mortality_ultimate ~ as.factor(SepsisFuzzyLogicPositive) + 
##     age_Ranges + gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + 
##     hospital_teaching_status + hospital_size + physicianSpeciality2 + 
##     hospitaldischargeyear + dialysis + aids + hepaticfailure + 
##     diabetes + immunosuppression + leukemia + lymphoma + metastaticcancer + 
##     thrombolytics + sofa_respiration_baseline2 + cardiovascular_baseline, 
##     family = "binomial", data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.8613  -0.5004  -0.2999  -0.1855   3.4055  
## 
## Coefficients:
##                                          Estimate Std. Error z value
## (Intercept)                             -3.703509   0.052600 -70.409
## as.factor(SepsisFuzzyLogicPositive)TRUE  1.759015   0.012570 139.935
## age_Ranges(25,35]                        0.263667   0.049480   5.329
## age_Ranges(35,45]                        0.477884   0.045685  10.460
## age_Ranges(45,55]                        0.800031   0.042270  18.927
## age_Ranges(55,65]                        1.054713   0.041430  25.458
## age_Ranges(65,75]                        1.297053   0.041250  31.444
## age_Ranges(75,85]                        1.595510   0.041199  38.727
## age_Ranges(85,100]                       1.846771   0.042060  43.907
## gender2Female                           -0.088610   0.009142  -9.692
## gender2Other/Unknown                     1.881151   0.189779   9.912
## ethnicity2African American               0.063468   0.015096   4.204
## ethnicity2Hispanic                       0.042223   0.021731   1.943
## ethnicity2Asian                          0.168140   0.038579   4.358
## ethnicity2Native American                0.336567   0.050201   6.704
## ethnicity2Other/Unknown                  0.169244   0.019481   8.688
## BMI_Ranges(18.5,25]                     -0.294102   0.019073 -15.420
## BMI_Ranges(25,35]                       -0.456729   0.018798 -24.297
## BMI_Ranges(35,200]                      -0.375163   0.020956 -17.903
## BMI_RangesOther/Unknown                  0.130032   0.027747   4.686
## icu_admit_source2OR/Proc Area           -1.469098   0.017785 -82.603
## icu_admit_source2Direct Admit           -0.183843   0.016137 -11.392
## icu_admit_source2Emergency Department   -0.440011   0.011052 -39.815
## icu_admit_source2Other                   0.009575   0.041861   0.229
## icu_admit_source2Step-Down Unit          0.203620   0.025668   7.933
## hospital_teaching_statusf               -0.074412   0.032934  -2.259
## hospital_teaching_statust               -0.196285   0.033411  -5.875
## hospital_size<100                       -0.541007   0.037110 -14.578
## hospital_size100-249                    -0.035444   0.025884  -1.369
## hospital_size250-500                     0.068296   0.026132   2.614
## hospital_size>500                        0.220763   0.024403   9.047
## physicianSpeciality2Speciality-Other    -0.254490   0.010172 -25.019
## hospitaldischargeyear2011               -0.040090   0.017261  -2.323
## hospitaldischargeyear2012               -0.067581   0.016650  -4.059
## hospitaldischargeyear2013               -0.111525   0.016367  -6.814
## hospitaldischargeyear2014               -0.143785   0.016309  -8.816
## hospitaldischargeyear2015-16            -0.129634   0.016130  -8.037
## dialysis1                                0.338289   0.022950  14.740
## aids1                                    0.466865   0.119626   3.903
## hepaticfailureTRUE                       0.574390   0.024879  23.087
## diabetes1                               -0.144764   0.011815 -12.253
## immunosuppression1                       0.295457   0.025719  11.488
## leukemia1                                0.398376   0.040567   9.820
## lymphoma1                                0.220802   0.057899   3.814
## metastaticcancer1                        0.640238   0.026978  23.732
## thrombolytics1                           0.191425   0.035568   5.382
## sofa_respiration_baseline2TRUE          -0.027827   0.010317  -2.697
## cardiovascular_baseline1                 0.113244   0.010540  10.744
##                                         Pr(>|z|)    
## (Intercept)                              < 2e-16 ***
## as.factor(SepsisFuzzyLogicPositive)TRUE  < 2e-16 ***
## age_Ranges(25,35]                       9.89e-08 ***
## age_Ranges(35,45]                        < 2e-16 ***
## age_Ranges(45,55]                        < 2e-16 ***
## age_Ranges(55,65]                        < 2e-16 ***
## age_Ranges(65,75]                        < 2e-16 ***
## age_Ranges(75,85]                        < 2e-16 ***
## age_Ranges(85,100]                       < 2e-16 ***
## gender2Female                            < 2e-16 ***
## gender2Other/Unknown                     < 2e-16 ***
## ethnicity2African American              2.62e-05 ***
## ethnicity2Hispanic                      0.052014 .  
## ethnicity2Asian                         1.31e-05 ***
## ethnicity2Native American               2.02e-11 ***
## ethnicity2Other/Unknown                  < 2e-16 ***
## BMI_Ranges(18.5,25]                      < 2e-16 ***
## BMI_Ranges(25,35]                        < 2e-16 ***
## BMI_Ranges(35,200]                       < 2e-16 ***
## BMI_RangesOther/Unknown                 2.78e-06 ***
## icu_admit_source2OR/Proc Area            < 2e-16 ***
## icu_admit_source2Direct Admit            < 2e-16 ***
## icu_admit_source2Emergency Department    < 2e-16 ***
## icu_admit_source2Other                  0.819081    
## icu_admit_source2Step-Down Unit         2.14e-15 ***
## hospital_teaching_statusf               0.023857 *  
## hospital_teaching_statust               4.23e-09 ***
## hospital_size<100                        < 2e-16 ***
## hospital_size100-249                    0.170899    
## hospital_size250-500                    0.008961 ** 
## hospital_size>500                        < 2e-16 ***
## physicianSpeciality2Speciality-Other     < 2e-16 ***
## hospitaldischargeyear2011               0.020203 *  
## hospitaldischargeyear2012               4.93e-05 ***
## hospitaldischargeyear2013               9.49e-12 ***
## hospitaldischargeyear2014                < 2e-16 ***
## hospitaldischargeyear2015-16            9.23e-16 ***
## dialysis1                                < 2e-16 ***
## aids1                                   9.51e-05 ***
## hepaticfailureTRUE                       < 2e-16 ***
## diabetes1                                < 2e-16 ***
## immunosuppression1                       < 2e-16 ***
## leukemia1                                < 2e-16 ***
## lymphoma1                               0.000137 ***
## metastaticcancer1                        < 2e-16 ***
## thrombolytics1                          7.37e-08 ***
## sofa_respiration_baseline2TRUE          0.006994 ** 
## cardiovascular_baseline1                 < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 399603  on 638756  degrees of freedom
## Residual deviance: 344313  on 638709  degrees of freedom
## AIC: 344409
## 
## Number of Fisher Scoring iterations: 6
ssd_incl_te$FuzzyLogicADJHospMortPred <- predict(FuzzyLogic_ADJ_Hosp_Mort_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")
library(sjPlot)
library(ROCR)

FuzzyLogicADJMort.Pred <- prediction(ssd_incl_te$FuzzyLogicADJHospMortPred, ssd_incl_te$hospital_mortality_ultimate)
FuzzyLogicADJMort.Perf <- performance(FuzzyLogicADJMort.Pred, "tpr", "fpr")
plot(FuzzyLogicADJMort.Perf, main = "FuzzyLogic Positive Adjusted 
     Mortality Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(FuzzyLogicADJMort.Pred,"auc")@y.values[[1]],3))) 

performance(FuzzyLogicADJMort.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.7767738
## 
## 
## Slot "alpha.values":
## list()
FuzzyLogicADJMort.Pred.roc <- roc(hospital_mortality_ultimate~ FuzzyLogicADJHospMortPred,data=ssd_incl_te)
ci(FuzzyLogicADJMort.Pred.roc, conf.level=0.99)
## 99% CI: 0.7733-0.7803 (DeLong)
ggplot(calibration(as.factor(hospital_mortality_ultimate==0)~FuzzyLogicADJHospMortPred, data = ssd_incl_te))+ggtitle("Calibration of ADJ Mortality FuzzyLogic Positive Prediction")
## Warning: Removed 1 rows containing missing values (geom_errorbar).

qplot(FuzzyLogicADJHospMortPred, data = ssd_incl_te)+ggtitle("Histogram of ADJ Mortality FuzzyLogic Positive Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

SIRS1_Crude_Hosp_Mort_tr<-glm(hospital_mortality_ultimate ~ as.factor(SIRS_total), data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(SIRS1_Crude_Hosp_Mort_tr)
#sjt.glm(SIRS1_Crude_Hosp_Mort_tr)

#drop1(SIRS1_Crude_Hosp_Mort_tr,test="Chisq")

summary(SIRS1_Crude_Hosp_Mort_tr)
## 
## Call:
## glm(formula = hospital_mortality_ultimate ~ as.factor(SIRS_total), 
##     family = "binomial", data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.7314  -0.5259  -0.3661  -0.2475   2.8642  
## 
## Coefficients:
##                        Estimate Std. Error z value Pr(>|z|)    
## (Intercept)            -4.08504    0.04215  -96.91   <2e-16 ***
## as.factor(SIRS_total)1  0.61417    0.04544   13.52   <2e-16 ***
## as.factor(SIRS_total)2  1.41584    0.04302   32.91   <2e-16 ***
## as.factor(SIRS_total)3  2.17657    0.04271   50.96   <2e-16 ***
## as.factor(SIRS_total)4  2.90312    0.04303   67.47   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 399603  on 638756  degrees of freedom
## Residual deviance: 370766  on 638752  degrees of freedom
## AIC: 370776
## 
## Number of Fisher Scoring iterations: 6
ssd_incl_te$SIRS1CrudeHospMortPred <- predict(SIRS1_Crude_Hosp_Mort_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")

SIRS1CrudeMort.Pred <- prediction(ssd_incl_te$SIRS1CrudeHospMortPred, ssd_incl_te$hospital_mortality_ultimate)
SIRS1CrudeMort.Perf <- performance(SIRS1CrudeMort.Pred, "tpr", "fpr")
plot(SIRS1CrudeMort.Perf, main = "SIRS Continuous Crude
     Mortality Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(SIRS1CrudeMort.Pred,"auc")@y.values[[1]],3))) 

performance(SIRS1CrudeMort.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.6959156
## 
## 
## Slot "alpha.values":
## list()
SIRS1CrudeMort.Pred.roc <- roc(hospital_mortality_ultimate~ SIRS1CrudeHospMortPred,data=ssd_incl_te)
ci(SIRS1CrudeMort.Pred.roc, conf.level=0.99)
## 99% CI: 0.6918-0.7 (DeLong)
ggplot(calibration(as.factor(hospital_mortality_ultimate==0)~SIRS1CrudeHospMortPred, data = ssd_incl_te))+ggtitle("Calibration of Crude  Mortality SIRS Total Prediction")
## Warning: Removed 8 rows containing missing values (geom_errorbar).

qplot(SIRS1CrudeHospMortPred, data = ssd_incl_te)+ggtitle("Histogram of Crude  Mortality SIRS Total Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

SIRS2_Crude_Hosp_Mort_tr<-glm(hospital_mortality_ultimate ~ as.factor(SIRS_Positive), data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(SIRS2_Crude_Hosp_Mort_tr)
#sjt.glm(SIRS2_Crude_Hosp_Mort_tr)

#drop1(SIRS2_Crude_Hosp_Mort_tr,test="Chisq")

summary(SIRS2_Crude_Hosp_Mort_tr)
## 
## Call:
## glm(formula = hospital_mortality_ultimate ~ as.factor(SIRS_Positive), 
##     family = "binomial", data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.4961  -0.4961  -0.4961  -0.2344   2.6865  
## 
## Coefficients:
##                              Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                  -3.58127    0.01573 -227.73   <2e-16 ***
## as.factor(SIRS_Positive)TRUE  1.54841    0.01635   94.68   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 399603  on 638756  degrees of freedom
## Residual deviance: 386134  on 638755  degrees of freedom
## AIC: 386138
## 
## Number of Fisher Scoring iterations: 6
ssd_incl_te$SIRS2CrudeHospMortPred <- predict(SIRS2_Crude_Hosp_Mort_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")

SIRS2CrudeMort.Pred <- prediction(ssd_incl_te$SIRS2CrudeHospMortPred, ssd_incl_te$hospital_mortality_ultimate)
SIRS2CrudeMort.Perf <- performance(SIRS2CrudeMort.Pred, "tpr", "fpr")
plot(SIRS2CrudeMort.Perf, main = "SIRS Positive Crude 
     Mortality Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(SIRS2CrudeMort.Pred,"auc")@y.values[[1]],3))) 

performance(SIRS2CrudeMort.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.5932939
## 
## 
## Slot "alpha.values":
## list()
SIRS2CrudeMort.Pred.roc <- roc(hospital_mortality_ultimate~ SIRS2CrudeHospMortPred,data=ssd_incl_te)
ci(SIRS2CrudeMort.Pred.roc, conf.level=0.99)
## 99% CI: 0.591-0.5956 (DeLong)
ggplot(calibration(as.factor(hospital_mortality_ultimate==0)~SIRS2CrudeHospMortPred, data = ssd_incl_te))+ggtitle("Calibration of Crude Mortality SIRS Positive Prediction")
## Warning: Removed 9 rows containing missing values (geom_errorbar).

qplot(SIRS2CrudeHospMortPred, data = ssd_incl_te)+ggtitle("Histogram of Crude Mortality SIRS Positive Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

SOFA1_Crude_Hosp_Mort_tr<-glm(hospital_mortality_ultimate ~ as.factor(SOFA_Change), data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(SOFA1_Crude_Hosp_Mort_tr)
#sjt.glm(SOFA1_Crude_Hosp_Mort_tr)

#drop1(SOFA1_Crude_Hosp_Mort_tr,test="Chisq")

summary(SOFA1_Crude_Hosp_Mort_tr)
## 
## Call:
## glm(formula = hospital_mortality_ultimate ~ as.factor(SOFA_Change), 
##     family = "binomial", data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.9792  -0.4160  -0.2553  -0.1955   3.0374  
## 
## Coefficients:
##                               Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                   -4.60300    0.04361 -105.54   <2e-16 ***
## as.factor(SOFA_Change) 1       0.65495    0.04767   13.74   <2e-16 ***
## as.factor(SOFA_Change) 2       1.19523    0.04735   25.24   <2e-16 ***
## as.factor(SOFA_Change) 3       1.77503    0.04620   38.42   <2e-16 ***
## as.factor(SOFA_Change) 4       2.19953    0.04568   48.15   <2e-16 ***
## as.factor(SOFA_Change) 5       2.59747    0.04553   57.05   <2e-16 ***
## as.factor(SOFA_Change) 6       2.82348    0.04590   61.52   <2e-16 ***
## as.factor(SOFA_Change) 7       3.28928    0.04577   71.87   <2e-16 ***
## as.factor(SOFA_Change) 8       3.52648    0.04639   76.02   <2e-16 ***
## as.factor(SOFA_Change) 9       3.81251    0.04714   80.88   <2e-16 ***
## as.factor(SOFA_Change)10       4.07496    0.04821   84.52   <2e-16 ***
## as.factor(SOFA_Change)11       4.46872    0.04968   89.95   <2e-16 ***
## as.factor(SOFA_Change)12       4.66489    0.05261   88.66   <2e-16 ***
## as.factor(SOFA_Change)13       4.97242    0.05686   87.46   <2e-16 ***
## as.factor(SOFA_Change)14       5.19252    0.06406   81.05   <2e-16 ***
## as.factor(SOFA_Change)15       5.49670    0.07577   72.54   <2e-16 ***
## as.factor(SOFA_Change)16       5.81940    0.09627   60.45   <2e-16 ***
## as.factor(SOFA_Change)17       6.17905    0.14112   43.79   <2e-16 ***
## as.factor(SOFA_Change)[18,23]  6.40953    0.15064   42.55   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 399603  on 638756  degrees of freedom
## Residual deviance: 322950  on 638738  degrees of freedom
## AIC: 322988
## 
## Number of Fisher Scoring iterations: 7
ssd_incl_te$SOFA1CrudeHospMortPred <- predict(SOFA1_Crude_Hosp_Mort_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")

SOFA1CrudeMort.Pred <- prediction(ssd_incl_te$SOFA1CrudeHospMortPred, ssd_incl_te$hospital_mortality_ultimate)
SOFA1CrudeMort.Perf <- performance(SOFA1CrudeMort.Pred, "tpr", "fpr")
plot(SOFA1CrudeMort.Perf, main = "SOFA Continuous Crude Mortality Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(SOFA1CrudeMort.Pred,"auc")@y.values[[1]],3))) 

performance(SOFA1CrudeMort.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.8037549
## 
## 
## Slot "alpha.values":
## list()
SOFA1CrudeMort.Pred.roc <- roc(hospital_mortality_ultimate~ SOFA1CrudeHospMortPred,data=ssd_incl_te)
ci(SOFA1CrudeMort.Pred.roc, conf.level=0.99)
## 99% CI: 0.8001-0.8074 (DeLong)
ggplot(calibration(as.factor(hospital_mortality_ultimate==0)~SOFA1CrudeHospMortPred, data = ssd_incl_te))+ggtitle("Calibration of Crude Mortality SOFA Total Prediction")
## Warning: Removed 1 rows containing missing values (geom_errorbar).

qplot(SOFA1CrudeHospMortPred, data = ssd_incl_te)+ggtitle("Histogram of Crude Mortality SOFA Total Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

SOFA2_Crude_Hosp_Mort_tr<-glm(hospital_mortality_ultimate ~ as.factor(SOFA_Positive), data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(SOFA2_Crude_Hosp_Mort_tr)
#sjt.glm(SOFA2_Crude_Hosp_Mort_tr)

#drop1(SOFA2_Crude_Hosp_Mort_tr,test="Chisq")

summary(SOFA2_Crude_Hosp_Mort_tr)
## 
## Call:
## glm(formula = hospital_mortality_ultimate ~ as.factor(SOFA_Positive), 
##     family = "binomial", data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.5273  -0.5273  -0.5273  -0.1825   2.8650  
## 
## Coefficients:
##                              Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                  -4.08741    0.01759  -232.4   <2e-16 ***
## as.factor(SOFA_Positive)TRUE  2.18450    0.01815   120.3   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 399603  on 638756  degrees of freedom
## Residual deviance: 372927  on 638755  degrees of freedom
## AIC: 372931
## 
## Number of Fisher Scoring iterations: 6
ssd_incl_te$SOFA2CrudeHospMortPred <- predict(SOFA2_Crude_Hosp_Mort_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")

SOFA2CrudeMort.Pred <- prediction(ssd_incl_te$SOFA2CrudeHospMortPred, ssd_incl_te$hospital_mortality_ultimate)
SOFA2CrudeMort.Perf <- performance(SOFA2CrudeMort.Pred, "tpr", "fpr")
plot(SOFA2CrudeMort.Perf, main = "SOFA Positive Crude
     Mortality Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(SOFA2CrudeMort.Pred,"auc")@y.values[[1]],3))) 

performance(SOFA2CrudeMort.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.640742
## 
## 
## Slot "alpha.values":
## list()
SOFA2CrudeMort.Pred.roc <- roc(hospital_mortality_ultimate~ SOFA2CrudeHospMortPred,data=ssd_incl_te)
ci(SOFA2CrudeMort.Pred.roc, conf.level=0.99)
## 99% CI: 0.6385-0.643 (DeLong)
ggplot(calibration(as.factor(hospital_mortality_ultimate==0)~SOFA2CrudeHospMortPred, data = ssd_incl_te))+ggtitle("Calibration of Crude Mortality SOFA Positive Prediction")
## Warning: Removed 9 rows containing missing values (geom_errorbar).

qplot(SOFA2CrudeHospMortPred, data = ssd_incl_te)+ggtitle("Histogram of Crude Mortality SOFA Positive Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

SOFA3_Crude_Hosp_Mort_tr<-glm(hospital_mortality_ultimate ~ as.factor(SOFA_Positive2), data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(SOFA3_Crude_Hosp_Mort_tr)
#sjt.glm(SOFA3_Crude_Hosp_Mort_tr)

#drop1(SOFA3_Crude_Hosp_Mort_tr,test="Chisq")

summary(SOFA3_Crude_Hosp_Mort_tr)
## 
## Call:
## glm(formula = hospital_mortality_ultimate ~ as.factor(SOFA_Positive2), 
##     family = "binomial", data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.5221  -0.5221  -0.5221  -0.1746   2.8952  
## 
## Coefficients:
##                               Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                   -4.17576    0.01892  -220.7   <2e-16 ***
## as.factor(SOFA_Positive2)TRUE  2.25170    0.01944   115.8   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 399603  on 638756  degrees of freedom
## Residual deviance: 373781  on 638755  degrees of freedom
## AIC: 373785
## 
## Number of Fisher Scoring iterations: 6
ssd_incl_te$SOFA3CrudeHospMortPred <- predict(SOFA3_Crude_Hosp_Mort_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")

SOFA3CrudeMort.Pred <- prediction(ssd_incl_te$SOFA3CrudeHospMortPred, ssd_incl_te$hospital_mortality_ultimate)
SOFA3CrudeMort.Perf <- performance(SOFA3CrudeMort.Pred, "tpr", "fpr")
plot(SOFA3CrudeMort.Perf, main = "SOFA Positive w/o Baseline Crude 
     Mortality Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(SOFA3CrudeMort.Pred,"auc")@y.values[[1]],3))) 

performance(SOFA3CrudeMort.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.6351032
## 
## 
## Slot "alpha.values":
## list()
SOFA3CrudeMort.Pred.roc <- roc(hospital_mortality_ultimate~ SOFA3CrudeHospMortPred,data=ssd_incl_te)
ci(SOFA3CrudeMort.Pred.roc, conf.level=0.99)
## 99% CI: 0.633-0.6372 (DeLong)
ggplot(calibration(as.factor(hospital_mortality_ultimate==0)~SOFA3CrudeHospMortPred, data = ssd_incl_te))+ggtitle("Calibration of Crude Mortality SOFA Positive w/o Baseline Prediction")
## Warning: Removed 9 rows containing missing values (geom_errorbar).

qplot(SOFA3CrudeHospMortPred, data = ssd_incl_te)+ggtitle("Histogram of Crude Mortality SOFA Positive w/o Baseline Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

qSOFA1_Crude_Hosp_Mort_tr<-glm(hospital_mortality_ultimate ~ as.factor(qSOFA_total), data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(qSOFA1_Crude_Hosp_Mort_tr)
#sjt.glm(qSOFA1_Crude_Hosp_Mort_tr)

#drop1(qSOFA1_Crude_Hosp_Mort_tr,test="Chisq")

summary(qSOFA1_Crude_Hosp_Mort_tr)
## 
## Call:
## glm(formula = hospital_mortality_ultimate ~ as.factor(qSOFA_total), 
##     family = "binomial", data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.6843  -0.4132  -0.4132  -0.2540   3.0033  
## 
## Coefficients:
##                         Estimate Std. Error z value Pr(>|z|)    
## (Intercept)             -4.49890    0.04501  -99.94   <2e-16 ***
## as.factor(qSOFA_total)1  1.08072    0.04716   22.91   <2e-16 ***
## as.factor(qSOFA_total)2  2.08091    0.04555   45.69   <2e-16 ***
## as.factor(qSOFA_total)3  3.16630    0.04545   69.67   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 399603  on 638756  degrees of freedom
## Residual deviance: 365260  on 638753  degrees of freedom
## AIC: 365268
## 
## Number of Fisher Scoring iterations: 7
ssd_incl_te$qSOFA1CrudeHospMortPred <- predict(qSOFA1_Crude_Hosp_Mort_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")
library(sjPlot)
library(ROCR)

qSOFA1CrudeMort.Pred <- prediction(ssd_incl_te$qSOFA1CrudeHospMortPred, ssd_incl_te$hospital_mortality_ultimate)
qSOFA1CrudeMort.Perf <- performance(qSOFA1CrudeMort.Pred, "tpr", "fpr")
plot(qSOFA1CrudeMort.Perf, main = "qSOFA1 Continuous Crude
     Mortality Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(qSOFA1CrudeMort.Pred,"auc")@y.values[[1]],3))) 

performance(qSOFA1CrudeMort.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.708034
## 
## 
## Slot "alpha.values":
## list()
qSOFA1CrudeMort.Pred.roc <- roc(hospital_mortality_ultimate~ qSOFA1CrudeHospMortPred,data=ssd_incl_te)
ci(qSOFA1CrudeMort.Pred.roc, conf.level=0.99)
## 99% CI: 0.7042-0.7118 (DeLong)
ggplot(calibration(as.factor(hospital_mortality_ultimate==0)~qSOFA1CrudeHospMortPred, data = ssd_incl_te))+ggtitle("Calibration of Crude Mortality qSOFA Total Prediction")
## Warning: Removed 9 rows containing missing values (geom_errorbar).

qplot(qSOFA1CrudeHospMortPred, data = ssd_incl_te)+ggtitle("Histogram of Crude Mortality qSOFA Total Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

qSOFA2_Crude_Hosp_Mort_tr<-glm(hospital_mortality_ultimate ~ as.factor(qSOFA_Positive), data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(qSOFA2_Crude_Hosp_Mort_tr)
#sjt.glm(qSOFA2_Crude_Hosp_Mort_tr)

#drop1(qSOFA2_Crude_Hosp_Mort_tr,test="Chisq")

summary(qSOFA2_Crude_Hosp_Mort_tr)
## 
## Call:
## glm(formula = hospital_mortality_ultimate ~ as.factor(qSOFA_Positive), 
##     family = "binomial", data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.5220  -0.5220  -0.5220  -0.2351   2.6843  
## 
## Coefficients:
##                               Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                   -3.57512    0.01341  -266.6   <2e-16 ***
## as.factor(qSOFA_Positive)TRUE  1.65074    0.01417   116.5   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 399603  on 638756  degrees of freedom
## Residual deviance: 379643  on 638755  degrees of freedom
## AIC: 379647
## 
## Number of Fisher Scoring iterations: 6
ssd_incl_te$qSOFA2CrudeHospMortPred <- predict(qSOFA2_Crude_Hosp_Mort_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")
library(sjPlot)
library(ROCR)

qSOFA2CrudeMort.Pred <- prediction(ssd_incl_te$qSOFA2CrudeHospMortPred, ssd_incl_te$hospital_mortality_ultimate)
qSOFA2CrudeMort.Perf <- performance(qSOFA2CrudeMort.Pred, "tpr", "fpr")
plot(qSOFA2CrudeMort.Perf, main = "qSOFA Positive Crude
     Mortality Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(qSOFA2CrudeMort.Pred,"auc")@y.values[[1]],3))) 

performance(qSOFA2CrudeMort.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.6290462
## 
## 
## Slot "alpha.values":
## list()
qSOFA2CrudeMort.Pred.roc <- roc(hospital_mortality_ultimate~ qSOFA2CrudeHospMortPred,data=ssd_incl_te)
ci(qSOFA2CrudeMort.Pred.roc, conf.level=0.99)
## 99% CI: 0.6264-0.6317 (DeLong)
ggplot(calibration(as.factor(hospital_mortality_ultimate==0)~qSOFA2CrudeHospMortPred, data = ssd_incl_te))+ggtitle("Calibration of Crude Mortality qSOFA Positive Prediction")
## Warning: Removed 9 rows containing missing values (geom_errorbar).

qplot(qSOFA2CrudeHospMortPred, data = ssd_incl_te)+ggtitle("Histogram of Crude Mortality qSOFA Positive Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

FuzzyLogic_Crude_Hosp_Mort_tr<-glm(hospital_mortality_ultimate ~ as.factor (SepsisFuzzyLogicPositive), data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(FuzzyLogic_Crude_Hosp_Mort_tr)
#sjt.glm(FuzzyLogic_Crude_Hosp_Mort_tr)

#drop1(FuzzyLogic_Crude_Hosp_Mort_tr,test="Chisq")

summary(FuzzyLogic_Crude_Hosp_Mort_tr)
## 
## Call:
## glm(formula = hospital_mortality_ultimate ~ as.factor(SepsisFuzzyLogicPositive), 
##     family = "binomial", data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.5675  -0.5675  -0.2384  -0.2384   2.6739  
## 
## Coefficients:
##                                         Estimate Std. Error z value
## (Intercept)                             -3.54651    0.01131  -313.6
## as.factor(SepsisFuzzyLogicPositive)TRUE  1.80202    0.01226   147.0
##                                         Pr(>|z|)    
## (Intercept)                               <2e-16 ***
## as.factor(SepsisFuzzyLogicPositive)TRUE   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 399603  on 638756  degrees of freedom
## Residual deviance: 369149  on 638755  degrees of freedom
## AIC: 369153
## 
## Number of Fisher Scoring iterations: 6
ssd_incl_te$FuzzyLogicCrudeHospMortPred <- predict(FuzzyLogic_Crude_Hosp_Mort_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")
library(sjPlot)
library(ROCR)

FuzzyLogicCrudeMort.Pred <- prediction(ssd_incl_te$FuzzyLogicCrudeHospMortPred, ssd_incl_te$hospital_mortality_ultimate)
FuzzyLogicCrudeMort.Perf <- performance(FuzzyLogicCrudeMort.Pred, "tpr", "fpr")
plot(FuzzyLogicCrudeMort.Perf, main = "FuzzyLogic Positive Crude 
     Mortality Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(FuzzyLogicCrudeMort.Pred,"auc")@y.values[[1]],3))) 

performance(FuzzyLogicCrudeMort.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.6734078
## 
## 
## Slot "alpha.values":
## list()
FuzzyLogicCrudeMort.Pred.roc <- roc(hospital_mortality_ultimate~ FuzzyLogicCrudeHospMortPred,data=ssd_incl_te)
ci(FuzzyLogicCrudeMort.Pred.roc, conf.level=0.99)
## 99% CI: 0.6704-0.6764 (DeLong)
ggplot(calibration(as.factor(hospital_mortality_ultimate==0)~FuzzyLogicCrudeHospMortPred, data = ssd_incl_te))+ggtitle("Calibration of Crude Mortality FuzzyLogic Positive Prediction")
## Warning: Removed 9 rows containing missing values (geom_errorbar).

qplot(FuzzyLogicCrudeHospMortPred, data = ssd_incl_te)+ggtitle("Histogram of Crude Mortality FuzzyLogic Positive Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

20 Setting up variables to analyze interactions

ssd_incl_te <- ssd_incl_te %>% mutate(hospital_mortality_ultimate2=hospital_mortality_ultimate)
ssd_incl_te <- ssd_incl_te %>% mutate(hospital_mortality_ultimate=as.logical(hospital_mortality_ultimate==1))
ssd_incl_te <- ssd_incl_te %>% mutate(SOFA2TruthMort=interaction(SOFA_Positive,hospital_mortality_ultimate))
ssd_incl_te <- ssd_incl_te %>% mutate(FuzzyLogicTruthMort=interaction(SepsisFuzzyLogicPositive, hospital_mortality_ultimate))
ssd_incl_te <- ssd_incl_te %>% mutate(qSOFA2TruthMort=interaction(qSOFA_Positive,hospital_mortality_ultimate))
ssd_incl_te <- ssd_incl_te %>% mutate(SIRS2TruthMort=interaction(SIRS_Positive,hospital_mortality_ultimate))
vars5 <- c("age_Ranges", "gender2", "ethnicity2", "BMI_Ranges", "physicianSpeciality2", "icu_admit_source2", "icu_disch_location2", "hospitaldischargeyear", "dischargelocation", "dialysis", "aids", "hepaticfailure",  "diabetes",  "immunosuppression" , "leukemia", "lymphoma", "metastaticcancer", "thrombolytics", "sofa_respiration_baseline2", "sofa_liver_baseline2", "sofa_renal_baseline2", "cardiovascular_baseline", "group")

library(dplyr); library(Hmisc); library(ggplot2); library(sjPlot)

if(!("tableone" %in% rownames(installed.packages()))) {
  install.packages("tableone")
}

library(tableone)

CreateTableOne(data=ssd_incl_te ,vars=vars5,strata="SIRS2TruthMort",test=FALSE, includeNA=TRUE
) %>% print(nonnormal= c("sofa_respiration_baseline2", "sofa_liver_baseline2", "sofa_renal_baseline2"),minMax=TRUE,
  printToggle      = FALSE,
  showAllLevels    = TRUE,
  cramVars         = "kon"
) %>%
{data.frame(
  variable_name             = gsub(" ", "&nbsp;", rownames(.), fixed = TRUE), .,                                                                                                                     
  row.names        = NULL,
  check.names      = FALSE,
  stringsAsFactors = FALSE)} %>%
  knitr::kable(caption="SIRS Positive Hospital Mortality TRUE/FALSE")
SIRS Positive Hospital Mortality TRUE/FALSE
variable_name level FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE
n 63427 184460 1792 24073
age_Ranges (%) (0,25] 1546 ( 2.4) 7255 ( 3.9) 1 ( 0.1) 249 ( 1.0)
(25,35] 2623 ( 4.1) 10909 ( 5.9) 14 ( 0.8) 514 ( 2.1)
(35,45] 4182 ( 6.6) 15147 ( 8.2) 22 ( 1.2) 977 ( 4.1)
(45,55] 9477 ( 14.9) 28450 (15.4) 136 ( 7.6) 2466 (10.2)
(55,65] 13742 ( 21.7) 38541 (20.9) 263 (14.7) 4558 (18.9)
(65,75] 14753 ( 23.3) 39638 (21.5) 426 (23.8) 5789 (24.0)
(75,85] 12022 ( 19.0) 30967 (16.8) 584 (32.6) 6049 (25.1)
(85,100] 5082 ( 8.0) 13553 ( 7.3) 346 (19.3) 3471 (14.4)
gender2 (%) Male 35515 ( 56.0) 97773 (53.0) 946 (52.8) 12668 (52.6)
Female 27900 ( 44.0) 86658 (47.0) 844 (47.1) 11368 (47.2)
Other/Unknown 12 ( 0.0) 29 ( 0.0) 2 ( 0.1) 37 ( 0.2)
ethnicity2 (%) Caucasian 48120 ( 75.9) 140669 (76.3) 1397 (78.0) 18502 (76.9)
African American 7152 ( 11.3) 21798 (11.8) 175 ( 9.8) 2604 (10.8)
Hispanic 2982 ( 4.7) 8115 ( 4.4) 96 ( 5.4) 1092 ( 4.5)
Asian 822 ( 1.3) 2349 ( 1.3) 23 ( 1.3) 339 ( 1.4)
Native American 452 ( 0.7) 1382 ( 0.7) 8 ( 0.4) 170 ( 0.7)
Other/Unknown 3899 ( 6.1) 10147 ( 5.5) 93 ( 5.2) 1366 ( 5.7)
BMI_Ranges (%) (0,18.5] 2426 ( 3.8) 9110 ( 4.9) 109 ( 6.1) 1803 ( 7.5)
(18.5,25] 16805 ( 26.5) 51771 (28.1) 519 (29.0) 7780 (32.3)
(25,35] 30888 ( 48.7) 83875 (45.5) 741 (41.4) 9708 (40.3)
(35,200] 10559 ( 16.6) 33940 (18.4) 308 (17.2) 3650 (15.2)
Other/Unknown 2749 ( 4.3) 5764 ( 3.1) 115 ( 6.4) 1132 ( 4.7)
physicianSpeciality2 (%) Critical Care 12577 ( 19.8) 57963 (31.4) 566 (31.6) 9189 (38.2)
Speciality-Other 50850 ( 80.2) 126497 (68.6) 1226 (68.4) 14884 (61.8)
icu_admit_source2 (%) Floor 8750 ( 13.8) 30563 (16.6) 479 (26.7) 6642 (27.6)
OR/Proc Area 11420 ( 18.0) 39542 (21.4) 139 ( 7.8) 1830 ( 7.6)
Direct Admit 7814 ( 12.3) 18602 (10.1) 204 (11.4) 2851 (11.8)
Emergency Department 34138 ( 53.8) 90266 (48.9) 896 (50.0) 11374 (47.2)
Other 397 ( 0.6) 1598 ( 0.9) 19 ( 1.1) 346 ( 1.4)
Step-Down Unit 908 ( 1.4) 3889 ( 2.1) 55 ( 3.1) 1030 ( 4.3)
icu_disch_location2 (%) Floor 46120 ( 72.7) 146188 (79.3) 667 (37.2) 6444 (26.8)
Death 0 ( 0.0) 0 ( 0.0) 1084 (60.5) 17271 (71.7)
Home 11549 ( 18.2) 15112 ( 8.2) 2 ( 0.1) 20 ( 0.1)
SNF/Rehab 848 ( 1.3) 3408 ( 1.8) 0 ( 0.0) 2 ( 0.0)
Other 1727 ( 2.7) 6959 ( 3.8) 15 ( 0.8) 104 ( 0.4)
Other Hospital 1363 ( 2.1) 4775 ( 2.6) 4 ( 0.2) 14 ( 0.1)
Step-Down Unit 1820 ( 2.9) 8018 ( 4.3) 20 ( 1.1) 218 ( 0.9)
hospitaldischargeyear (%) -2010 8716 ( 13.7) 21266 (11.5) 263 (14.7) 3103 (12.9)
2011 8885 ( 14.0) 24249 (13.1) 301 (16.8) 3379 (14.0)
2012 10336 ( 16.3) 30215 (16.4) 273 (15.2) 3986 (16.6)
2013 11374 ( 17.9) 34135 (18.5) 312 (17.4) 4441 (18.4)
2014 12378 ( 19.5) 36465 (19.8) 312 (17.4) 4396 (18.3)
2015-16 11738 ( 18.5) 38130 (20.7) 331 (18.5) 4768 (19.8)
dischargelocation (mean (sd)) 5.15 (1.63) 5.02 (1.64) 7.17 (2.38) 7.69 (2.18)
dialysis (%) 0 61202 ( 96.5) 178604 (96.8) 1691 (94.4) 22997 (95.5)
1 2225 ( 3.5) 5856 ( 3.2) 101 ( 5.6) 1076 ( 4.5)
aids (%) 0 63396 (100.0) 184261 (99.9) 1790 (99.9) 24042 (99.9)
1 31 ( 0.0) 199 ( 0.1) 2 ( 0.1) 31 ( 0.1)
hepaticfailure (%) FALSE 62336 ( 98.3) 180827 (98.0) 1719 (95.9) 23189 (96.3)
TRUE 1091 ( 1.7) 3633 ( 2.0) 73 ( 4.1) 884 ( 3.7)
diabetes (%) 0 49225 ( 77.6) 143639 (77.9) 1403 (78.3) 19653 (81.6)
1 14202 ( 22.4) 40821 (22.1) 389 (21.7) 4420 (18.4)
immunosuppression (%) 0 62554 ( 98.6) 180037 (97.6) 1752 (97.8) 23043 (95.7)
1 873 ( 1.4) 4423 ( 2.4) 40 ( 2.2) 1030 ( 4.3)
leukemia (%) 0 63177 ( 99.6) 183156 (99.3) 1787 (99.7) 23694 (98.4)
1 250 ( 0.4) 1304 ( 0.7) 5 ( 0.3) 379 ( 1.6)
lymphoma (%) 0 63262 ( 99.7) 183762 (99.6) 1783 (99.5) 23915 (99.3)
1 165 ( 0.3) 698 ( 0.4) 9 ( 0.5) 158 ( 0.7)
metastaticcancer (%) 0 62573 ( 98.7) 180962 (98.1) 1748 (97.5) 23163 (96.2)
1 854 ( 1.3) 3498 ( 1.9) 44 ( 2.5) 910 ( 3.8)
thrombolytics (%) 0 61472 ( 96.9) 181851 (98.6) 1764 (98.4) 23697 (98.4)
1 1955 ( 3.1) 2609 ( 1.4) 28 ( 1.6) 376 ( 1.6)
sofa_respiration_baseline2 (%) FALSE 51153 ( 80.6) 138294 (75.0) 1296 (72.3) 17265 (71.7)
TRUE 12274 ( 19.4) 46166 (25.0) 496 (27.7) 6808 (28.3)
sofa_liver_baseline2 (%) FALSE 62336 ( 98.3) 180827 (98.0) 1719 (95.9) 23189 (96.3)
TRUE 1091 ( 1.7) 3633 ( 2.0) 73 ( 4.1) 884 ( 3.7)
sofa_renal_baseline2 (%) FALSE 61202 ( 96.5) 178604 (96.8) 1691 (94.4) 22997 (95.5)
TRUE 2225 ( 3.5) 5856 ( 3.2) 101 ( 5.6) 1076 ( 4.5)
cardiovascular_baseline (%) 0 47719 ( 75.2) 145389 (78.8) 1135 (63.3) 17618 (73.2)
1 15708 ( 24.8) 39071 (21.2) 657 (36.7) 6455 (26.8)
group (%) Cardiovascular 27116 ( 42.8) 53849 (29.2) 534 (29.8) 6864 (28.5)
Gastrointestinal 5746 ( 9.1) 20519 (11.1) 160 ( 8.9) 2119 ( 8.8)
Gynaecological 105 ( 0.2) 601 ( 0.3) 0 ( 0.0) 9 ( 0.0)
Hematological 418 ( 0.7) 1497 ( 0.8) 11 ( 0.6) 160 ( 0.7)
Metabolic 5782 ( 9.1) 16247 ( 8.8) 41 ( 2.3) 391 ( 1.6)
Muscoskeletal/Skin disease 718 ( 1.1) 2614 ( 1.4) 8 ( 0.4) 118 ( 0.5)
Neurological 10296 ( 16.2) 23204 (12.6) 364 (20.3) 2973 (12.3)
Renal/Genitourinary 1532 ( 2.4) 4569 ( 2.5) 39 ( 2.2) 436 ( 1.8)
Respiratory 5980 ( 9.4) 29736 (16.1) 364 (20.3) 4778 (19.8)
Sepsis 2424 ( 3.8) 21609 (11.7) 185 (10.3) 5119 (21.3)
Trauma 2837 ( 4.5) 8359 ( 4.5) 74 ( 4.1) 855 ( 3.6)
Undefined 473 ( 0.7) 1656 ( 0.9) 12 ( 0.7) 251 ( 1.0)
vars5 <- c("age_Ranges", "gender2", "ethnicity2", "BMI_Ranges", "physicianSpeciality2", "icu_admit_source2", "icu_disch_location2", "hospitaldischargeyear", "dischargelocation", "dialysis", "aids", "hepaticfailure", "diabetes",  "immunosuppression" , "leukemia", "lymphoma", "metastaticcancer", "thrombolytics", "sofa_respiration_baseline2", "sofa_liver_baseline2", "sofa_renal_baseline2", "cardiovascular_baseline", "group")



if(!("tableone" %in% rownames(installed.packages()))) {
  install.packages("tableone")
}
library(dplyr); library(Hmisc); library(ggplot2); #library(sjPlot)
library(tableone)

CreateTableOne(data=ssd_incl_te ,vars=vars5,strata="qSOFA2TruthMort",test=FALSE, includeNA=TRUE
) %>% print(nonnormal= c("sofa_respiration_baseline2", "sofa_liver_baseline2", "sofa_renal_baseline2"),minMax=TRUE,
  printToggle      = FALSE,
  showAllLevels    = TRUE,
  cramVars         = "kon"
) %>%
{data.frame(
  variable_name             = gsub(" ", "&nbsp;", rownames(.), fixed = TRUE), .,                                                                                                                     
  row.names        = NULL,
  check.names      = FALSE,
  stringsAsFactors = FALSE)} %>%
  knitr::kable(caption="qSOFA Positive Hospital Mortality TRUE/FALSE")
qSOFA Positive Hospital Mortality TRUE/FALSE
variable_name level FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE
n 87257 160630 2429 23436
age_Ranges (%) (0,25] 3389 ( 3.9) 5412 ( 3.4) 14 ( 0.6) 236 ( 1.0)
(25,35] 5308 ( 6.1) 8224 ( 5.1) 38 ( 1.6) 490 ( 2.1)
(35,45] 7662 ( 8.8) 11667 ( 7.3) 92 ( 3.8) 907 ( 3.9)
(45,55] 14184 (16.3) 23743 (14.8) 208 ( 8.6) 2394 (10.2)
(55,65] 18886 (21.6) 33397 (20.8) 451 (18.6) 4370 (18.6)
(65,75] 18746 (21.5) 35645 (22.2) 642 (26.4) 5573 (23.8)
(75,85] 13930 (16.0) 29059 (18.1) 689 (28.4) 5944 (25.4)
(85,100] 5152 ( 5.9) 13483 ( 8.4) 295 (12.1) 3522 (15.0)
gender2 (%) Male 49579 (56.8) 83709 (52.1) 1318 (54.3) 12296 (52.5)
Female 37660 (43.2) 76898 (47.9) 1106 (45.5) 11106 (47.4)
Other/Unknown 18 ( 0.0) 23 ( 0.0) 5 ( 0.2) 34 ( 0.1)
ethnicity2 (%) Caucasian 64139 (73.5) 124650 (77.6) 1885 (77.6) 18014 (76.9)
African American 11434 (13.1) 17516 (10.9) 252 (10.4) 2527 (10.8)
Hispanic 4310 ( 4.9) 6787 ( 4.2) 117 ( 4.8) 1071 ( 4.6)
Asian 1074 ( 1.2) 2097 ( 1.3) 23 ( 0.9) 339 ( 1.4)
Native American 620 ( 0.7) 1214 ( 0.8) 15 ( 0.6) 163 ( 0.7)
Other/Unknown 5680 ( 6.5) 8366 ( 5.2) 137 ( 5.6) 1322 ( 5.6)
BMI_Ranges (%) (0,18.5] 3337 ( 3.8) 8199 ( 5.1) 166 ( 6.8) 1746 ( 7.5)
(18.5,25] 22470 (25.8) 46106 (28.7) 779 (32.1) 7520 (32.1)
(25,35] 42118 (48.3) 72645 (45.2) 981 (40.4) 9468 (40.4)
(35,200] 15898 (18.2) 28601 (17.8) 377 (15.5) 3581 (15.3)
Other/Unknown 3434 ( 3.9) 5079 ( 3.2) 126 ( 5.2) 1121 ( 4.8)
physicianSpeciality2 (%) Critical Care 18845 (21.6) 51695 (32.2) 778 (32.0) 8977 (38.3)
Speciality-Other 68412 (78.4) 108935 (67.8) 1651 (68.0) 14459 (61.7)
icu_admit_source2 (%) Floor 12015 (13.8) 27298 (17.0) 632 (26.0) 6489 (27.7)
OR/Proc Area 18237 (20.9) 32725 (20.4) 242 (10.0) 1727 ( 7.4)
Direct Admit 9788 (11.2) 16628 (10.4) 300 (12.4) 2755 (11.8)
Emergency Department 45347 (52.0) 79057 (49.2) 1133 (46.6) 11137 (47.5)
Other 580 ( 0.7) 1415 ( 0.9) 29 ( 1.2) 336 ( 1.4)
Step-Down Unit 1290 ( 1.5) 3507 ( 2.2) 93 ( 3.8) 992 ( 4.2)
icu_disch_location2 (%) Floor 65372 (74.9) 126936 (79.0) 816 (33.6) 6295 (26.9)
Death 0 ( 0.0) 0 ( 0.0) 1552 (63.9) 16803 (71.7)
Home 13771 (15.8) 12890 ( 8.0) 4 ( 0.2) 18 ( 0.1)
SNF/Rehab 952 ( 1.1) 3304 ( 2.1) 0 ( 0.0) 2 ( 0.0)
Other 2252 ( 2.6) 6434 ( 4.0) 19 ( 0.8) 100 ( 0.4)
Other Hospital 1733 ( 2.0) 4405 ( 2.7) 2 ( 0.1) 16 ( 0.1)
Step-Down Unit 3177 ( 3.6) 6661 ( 4.1) 36 ( 1.5) 202 ( 0.9)
hospitaldischargeyear (%) -2010 12131 (13.9) 17851 (11.1) 455 (18.7) 2911 (12.4)
2011 12029 (13.8) 21105 (13.1) 393 (16.2) 3287 (14.0)
2012 13867 (15.9) 26684 (16.6) 364 (15.0) 3895 (16.6)
2013 15366 (17.6) 30143 (18.8) 412 (17.0) 4341 (18.5)
2014 17035 (19.5) 31808 (19.8) 393 (16.2) 4315 (18.4)
2015-16 16829 (19.3) 33039 (20.6) 412 (17.0) 4687 (20.0)
dischargelocation (mean (sd)) 5.06 (1.60) 5.05 (1.66) 7.33 (2.34) 7.68 (2.18)
dialysis (%) 0 84312 (96.6) 155494 (96.8) 2327 (95.8) 22361 (95.4)
1 2945 ( 3.4) 5136 ( 3.2) 102 ( 4.2) 1075 ( 4.6)
aids (%) 0 87187 (99.9) 160470 (99.9) 2427 (99.9) 23405 (99.9)
1 70 ( 0.1) 160 ( 0.1) 2 ( 0.1) 31 ( 0.1)
hepaticfailure (%) FALSE 85884 (98.4) 157279 (97.9) 2365 (97.4) 22543 (96.2)
TRUE 1373 ( 1.6) 3351 ( 2.1) 64 ( 2.6) 893 ( 3.8)
diabetes (%) 0 67023 (76.8) 125841 (78.3) 1952 (80.4) 19104 (81.5)
1 20234 (23.2) 34789 (21.7) 477 (19.6) 4332 (18.5)
immunosuppression (%) 0 85620 (98.1) 156971 (97.7) 2308 (95.0) 22487 (96.0)
1 1637 ( 1.9) 3659 ( 2.3) 121 ( 5.0) 949 ( 4.0)
leukemia (%) 0 86780 (99.5) 159553 (99.3) 2397 (98.7) 23084 (98.5)
1 477 ( 0.5) 1077 ( 0.7) 32 ( 1.3) 352 ( 1.5)
lymphoma (%) 0 87015 (99.7) 160009 (99.6) 2413 (99.3) 23285 (99.4)
1 242 ( 0.3) 621 ( 0.4) 16 ( 0.7) 151 ( 0.6)
metastaticcancer (%) 0 85825 (98.4) 157710 (98.2) 2335 (96.1) 22576 (96.3)
1 1432 ( 1.6) 2920 ( 1.8) 94 ( 3.9) 860 ( 3.7)
thrombolytics (%) 0 85090 (97.5) 158233 (98.5) 2391 (98.4) 23070 (98.4)
1 2167 ( 2.5) 2397 ( 1.5) 38 ( 1.6) 366 ( 1.6)
sofa_respiration_baseline2 (%) FALSE 69286 (79.4) 120161 (74.8) 1672 (68.8) 16889 (72.1)
TRUE 17971 (20.6) 40469 (25.2) 757 (31.2) 6547 (27.9)
sofa_liver_baseline2 (%) FALSE 85884 (98.4) 157279 (97.9) 2365 (97.4) 22543 (96.2)
TRUE 1373 ( 1.6) 3351 ( 2.1) 64 ( 2.6) 893 ( 3.8)
sofa_renal_baseline2 (%) FALSE 84312 (96.6) 155494 (96.8) 2327 (95.8) 22361 (95.4)
TRUE 2945 ( 3.4) 5136 ( 3.2) 102 ( 4.2) 1075 ( 4.6)
cardiovascular_baseline (%) 0 69275 (79.4) 123833 (77.1) 1744 (71.8) 17009 (72.6)
1 17982 (20.6) 36797 (22.9) 685 (28.2) 6427 (27.4)
group (%) Cardiovascular 33024 (37.8) 47941 (29.8) 690 (28.4) 6708 (28.6)
Gastrointestinal 9742 (11.2) 16523 (10.3) 211 ( 8.7) 2068 ( 8.8)
Gynaecological 276 ( 0.3) 430 ( 0.3) 0 ( 0.0) 9 ( 0.0)
Hematological 795 ( 0.9) 1120 ( 0.7) 18 ( 0.7) 153 ( 0.7)
Metabolic 8223 ( 9.4) 13806 ( 8.6) 38 ( 1.6) 394 ( 1.7)
Muscoskeletal/Skin disease 1196 ( 1.4) 2136 ( 1.3) 11 ( 0.5) 115 ( 0.5)
Neurological 11591 (13.3) 21909 (13.6) 429 (17.7) 2908 (12.4)
Renal/Genitourinary 2151 ( 2.5) 3950 ( 2.5) 45 ( 1.9) 430 ( 1.8)
Respiratory 10416 (11.9) 25300 (15.8) 542 (22.3) 4600 (19.6)
Sepsis 4434 ( 5.1) 19599 (12.2) 303 (12.5) 5001 (21.3)
Trauma 4534 ( 5.2) 6662 ( 4.1) 108 ( 4.4) 821 ( 3.5)
Undefined 875 ( 1.0) 1254 ( 0.8) 34 ( 1.4) 229 ( 1.0)
vars5 <- c("age_Ranges", "gender2", "ethnicity2", "BMI_Ranges", "physicianSpeciality2", "icu_admit_source2", "icu_disch_location2", "hospitaldischargeyear", "dischargelocation", "dialysis", "aids", "hepaticfailure",  "diabetes",  "immunosuppression" , "leukemia", "lymphoma", "metastaticcancer", "thrombolytics", "sofa_respiration_baseline2", "sofa_liver_baseline2", "sofa_renal_baseline2", "cardiovascular_baseline", "group")



if(!("tableone" %in% rownames(installed.packages()))) {
  install.packages("tableone")
}

library(tableone)

CreateTableOne(data=ssd_incl_te ,vars=vars5,strata="SOFA2TruthMort",test=FALSE, includeNA=TRUE
) %>% print(nonnormal= c("sofa_respiration_baseline2", "sofa_liver_baseline2", "sofa_renal_baseline2"),minMax=TRUE,
  printToggle      = FALSE,
  showAllLevels    = TRUE,
  cramVars         = "kon"
) %>%
{data.frame(
  variable_name             = gsub(" ", "&nbsp;", rownames(.), fixed = TRUE), .,                                                                                                                     
  row.names        = NULL,
  check.names      = FALSE,
  stringsAsFactors = FALSE)} %>%
  knitr::kable(caption="SOFA Positive Hospital Mortality TRUE/FALSE")
SOFA Positive Hospital Mortality TRUE/FALSE
variable_name level FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE
n 83807 164080 1464 24401
age_Ranges (%) (0,25] 4029 ( 4.8) 4772 ( 2.9) 5 ( 0.3) 245 ( 1.0)
(25,35] 5833 ( 7.0) 7699 ( 4.7) 14 ( 1.0) 514 ( 2.1)
(35,45] 8346 (10.0) 10983 ( 6.7) 35 ( 2.4) 964 ( 4.0)
(45,55] 15061 (18.0) 22866 (13.9) 120 ( 8.2) 2482 (10.2)
(55,65] 18448 (22.0) 33835 (20.6) 296 (20.2) 4525 (18.5)
(65,75] 16686 (19.9) 37705 (23.0) 402 (27.5) 5813 (23.8)
(75,85] 11248 (13.4) 31741 (19.3) 405 (27.7) 6228 (25.5)
(85,100] 4156 ( 5.0) 14479 ( 8.8) 187 (12.8) 3630 (14.9)
gender2 (%) Male 43050 (51.4) 90238 (55.0) 692 (47.3) 12922 (53.0)
Female 40746 (48.6) 73812 (45.0) 770 (52.6) 11442 (46.9)
Other/Unknown 11 ( 0.0) 30 ( 0.0) 2 ( 0.1) 37 ( 0.2)
ethnicity2 (%) Caucasian 63802 (76.1) 124987 (76.2) 1207 (82.4) 18692 (76.6)
African American 9866 (11.8) 19084 (11.6) 111 ( 7.6) 2668 (10.9)
Hispanic 3658 ( 4.4) 7439 ( 4.5) 52 ( 3.6) 1136 ( 4.7)
Asian 1019 ( 1.2) 2152 ( 1.3) 20 ( 1.4) 342 ( 1.4)
Native American 553 ( 0.7) 1281 ( 0.8) 1 ( 0.1) 177 ( 0.7)
Other/Unknown 4909 ( 5.9) 9137 ( 5.6) 73 ( 5.0) 1386 ( 5.7)
BMI_Ranges (%) (0,18.5] 3586 ( 4.3) 7950 ( 4.8) 155 (10.6) 1757 ( 7.2)
(18.5,25] 22640 (27.0) 45936 (28.0) 519 (35.5) 7780 (31.9)
(25,35] 39257 (46.8) 75506 (46.0) 569 (38.9) 9880 (40.5)
(35,200] 14808 (17.7) 29691 (18.1) 166 (11.3) 3792 (15.5)
Other/Unknown 3516 ( 4.2) 4997 ( 3.0) 55 ( 3.8) 1192 ( 4.9)
physicianSpeciality2 (%) Critical Care 16917 (20.2) 53623 (32.7) 471 (32.2) 9284 (38.0)
Speciality-Other 66890 (79.8) 110457 (67.3) 993 (67.8) 15117 (62.0)
icu_admit_source2 (%) Floor 11167 (13.3) 28146 (17.2) 488 (33.3) 6633 (27.2)
OR/Proc Area 15787 (18.8) 35175 (21.4) 87 ( 5.9) 1882 ( 7.7)
Direct Admit 9574 (11.4) 16842 (10.3) 154 (10.5) 2901 (11.9)
Emergency Department 45511 (54.3) 78893 (48.1) 654 (44.7) 11616 (47.6)
Other 551 ( 0.7) 1444 ( 0.9) 19 ( 1.3) 346 ( 1.4)
Step-Down Unit 1217 ( 1.5) 3580 ( 2.2) 62 ( 4.2) 1023 ( 4.2)
icu_disch_location2 (%) Floor 62101 (74.1) 130207 (79.4) 593 (40.5) 6518 (26.7)
Death 0 ( 0.0) 0 ( 0.0) 830 (56.7) 17525 (71.8)
Home 14699 (17.5) 11962 ( 7.3) 2 ( 0.1) 20 ( 0.1)
SNF/Rehab 683 ( 0.8) 3573 ( 2.2) 0 ( 0.0) 2 ( 0.0)
Other 2198 ( 2.6) 6488 ( 4.0) 5 ( 0.3) 114 ( 0.5)
Other Hospital 1623 ( 1.9) 4515 ( 2.8) 6 ( 0.4) 12 ( 0.0)
Step-Down Unit 2503 ( 3.0) 7335 ( 4.5) 28 ( 1.9) 210 ( 0.9)
hospitaldischargeyear (%) -2010 9788 (11.7) 20194 (12.3) 193 (13.2) 3173 (13.0)
2011 10699 (12.8) 22435 (13.7) 200 (13.7) 3480 (14.3)
2012 13477 (16.1) 27074 (16.5) 234 (16.0) 4025 (16.5)
2013 15974 (19.1) 29535 (18.0) 287 (19.6) 4466 (18.3)
2014 17191 (20.5) 31652 (19.3) 263 (18.0) 4445 (18.2)
2015-16 16678 (19.9) 33190 (20.2) 287 (19.6) 4812 (19.7)
dischargelocation (mean (sd)) 5.16 (1.65) 5.00 (1.63) 7.01 (2.41) 7.69 (2.18)
dialysis (%) 0 80629 (96.2) 159177 (97.0) 1390 (94.9) 23298 (95.5)
1 3178 ( 3.8) 4903 ( 3.0) 74 ( 5.1) 1103 ( 4.5)
aids (%) 0 83751 (99.9) 163906 (99.9) 1462 (99.9) 24370 (99.9)
1 56 ( 0.1) 174 ( 0.1) 2 ( 0.1) 31 ( 0.1)
hepaticfailure (%) FALSE 83104 (99.2) 160059 (97.5) 1438 (98.2) 23470 (96.2)
TRUE 703 ( 0.8) 4021 ( 2.5) 26 ( 1.8) 931 ( 3.8)
diabetes (%) 0 66157 (78.9) 126707 (77.2) 1217 (83.1) 19839 (81.3)
1 17650 (21.1) 37373 (22.8) 247 (16.9) 4562 (18.7)
immunosuppression (%) 0 82356 (98.3) 160235 (97.7) 1372 (93.7) 23423 (96.0)
1 1451 ( 1.7) 3845 ( 2.3) 92 ( 6.3) 978 ( 4.0)
leukemia (%) 0 83514 (99.7) 162819 (99.2) 1454 (99.3) 24027 (98.5)
1 293 ( 0.3) 1261 ( 0.8) 10 ( 0.7) 374 ( 1.5)
lymphoma (%) 0 83612 (99.8) 163412 (99.6) 1459 (99.7) 24239 (99.3)
1 195 ( 0.2) 668 ( 0.4) 5 ( 0.3) 162 ( 0.7)
metastaticcancer (%) 0 82448 (98.4) 161087 (98.2) 1372 (93.7) 23539 (96.5)
1 1359 ( 1.6) 2993 ( 1.8) 92 ( 6.3) 862 ( 3.5)
thrombolytics (%) 0 81143 (96.8) 162180 (98.8) 1439 (98.3) 24022 (98.4)
1 2664 ( 3.2) 1900 ( 1.2) 25 ( 1.7) 379 ( 1.6)
sofa_respiration_baseline2 (%) FALSE 64372 (76.8) 125075 (76.2) 788 (53.8) 17773 (72.8)
TRUE 19435 (23.2) 39005 (23.8) 676 (46.2) 6628 (27.2)
sofa_liver_baseline2 (%) FALSE 83104 (99.2) 160059 (97.5) 1438 (98.2) 23470 (96.2)
TRUE 703 ( 0.8) 4021 ( 2.5) 26 ( 1.8) 931 ( 3.8)
sofa_renal_baseline2 (%) FALSE 80629 (96.2) 159177 (97.0) 1390 (94.9) 23298 (95.5)
TRUE 3178 ( 3.8) 4903 ( 3.0) 74 ( 5.1) 1103 ( 4.5)
cardiovascular_baseline (%) 0 68828 (82.1) 124280 (75.7) 1060 (72.4) 17693 (72.5)
1 14979 (17.9) 39800 (24.3) 404 (27.6) 6708 (27.5)
group (%) Cardiovascular 30780 (36.7) 50185 (30.6) 343 (23.4) 7055 (28.9)
Gastrointestinal 8099 ( 9.7) 18166 (11.1) 109 ( 7.4) 2170 ( 8.9)
Gynaecological 263 ( 0.3) 443 ( 0.3) 3 ( 0.2) 6 ( 0.0)
Hematological 483 ( 0.6) 1432 ( 0.9) 5 ( 0.3) 166 ( 0.7)
Metabolic 8569 (10.2) 13460 ( 8.2) 15 ( 1.0) 417 ( 1.7)
Muscoskeletal/Skin disease 1209 ( 1.4) 2123 ( 1.3) 4 ( 0.3) 122 ( 0.5)
Neurological 12651 (15.1) 20849 (12.7) 159 (10.9) 3178 (13.0)
Renal/Genitourinary 980 ( 1.2) 5121 ( 3.1) 15 ( 1.0) 460 ( 1.9)
Respiratory 12189 (14.5) 23527 (14.3) 576 (39.3) 4566 (18.7)
Sepsis 3416 ( 4.1) 20617 (12.6) 154 (10.5) 5150 (21.1)
Trauma 4140 ( 4.9) 7056 ( 4.3) 36 ( 2.5) 893 ( 3.7)
Undefined 1028 ( 1.2) 1101 ( 0.7) 45 ( 3.1) 218 ( 0.9)
vars5 <- c("age_Ranges", "gender2", "ethnicity2", "BMI_Ranges", "physicianSpeciality2", "icu_admit_source2", "icu_disch_location2", "hospitaldischargeyear", "dischargelocation", "dialysis", "aids", "hepaticfailure",  "diabetes",  "immunosuppression" , "leukemia", "lymphoma", "metastaticcancer", "thrombolytics", "sofa_respiration_baseline2", "sofa_liver_baseline2", "sofa_renal_baseline2", "cardiovascular_baseline", "group")

library(dplyr); library(Hmisc); library(ggplot2); #library(sjPlot)

if(!("tableone" %in% rownames(installed.packages()))) {
  install.packages("tableone")
}
library(dplyr); library(Hmisc); library(ggplot2); #library(sjPlot)
library(tableone)

CreateTableOne(data=ssd_incl_te ,vars=vars5,strata="FuzzyLogicTruthMort",test=FALSE, includeNA=TRUE
) %>% print(nonnormal= c("sofa_respiration_baseline2", "sofa_liver_baseline2", "sofa_renal_baseline2"),minMax=TRUE,
  printToggle      = FALSE,
  showAllLevels    = TRUE,
  cramVars         = "kon"
) %>%
{data.frame(
  variable_name             = gsub(" ", "&nbsp;", rownames(.), fixed = TRUE), .,                                                                                                                     
  row.names        = NULL,
  check.names      = FALSE,
  stringsAsFactors = FALSE)} %>%
  knitr::kable(caption="FuzzyLogic Positive Hospital Mortality TRUE/FALSE")
FuzzyLogic Positive Hospital Mortality TRUE/FALSE
variable_name level FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE
n 119438 128449 3492 22373
age_Ranges (%) (0,25] 4013 ( 3.4) 4788 ( 3.7) 10 ( 0.3) 240 ( 1.1)
(25,35] 6627 ( 5.5) 6905 ( 5.4) 38 ( 1.1) 490 ( 2.2)
(35,45] 9846 ( 8.2) 9483 ( 7.4) 93 ( 2.7) 906 ( 4.0)
(45,55] 18948 (15.9) 18979 (14.8) 266 ( 7.6) 2336 (10.4)
(55,65] 25293 (21.2) 26990 (21.0) 560 (16.0) 4261 (19.0)
(65,75] 25677 (21.5) 28714 (22.4) 836 (23.9) 5379 (24.0)
(75,85] 20248 (17.0) 22741 (17.7) 1042 (29.8) 5591 (25.0)
(85,100] 8786 ( 7.4) 9849 ( 7.7) 647 (18.5) 3170 (14.2)
gender2 (%) Male 65930 (55.2) 67358 (52.4) 1846 (52.9) 11768 (52.6)
Female 53490 (44.8) 61068 (47.5) 1638 (46.9) 10574 (47.3)
Other/Unknown 18 ( 0.0) 23 ( 0.0) 8 ( 0.2) 31 ( 0.1)
ethnicity2 (%) Caucasian 89699 (75.1) 99090 (77.1) 2680 (76.7) 17219 (77.0)
African American 15185 (12.7) 13765 (10.7) 393 (11.3) 2386 (10.7)
Hispanic 5262 ( 4.4) 5835 ( 4.5) 137 ( 3.9) 1051 ( 4.7)
Asian 1590 ( 1.3) 1581 ( 1.2) 53 ( 1.5) 309 ( 1.4)
Native American 865 ( 0.7) 969 ( 0.8) 19 ( 0.5) 159 ( 0.7)
Other/Unknown 6837 ( 5.7) 7209 ( 5.6) 210 ( 6.0) 1249 ( 5.6)
BMI_Ranges (%) (0,18.5] 4891 ( 4.1) 6645 ( 5.2) 244 ( 7.0) 1668 ( 7.5)
(18.5,25] 32335 (27.1) 36241 (28.2) 1131 (32.4) 7168 (32.0)
(25,35] 56696 (47.5) 58067 (45.2) 1420 (40.7) 9029 (40.4)
(35,200] 20582 (17.2) 23917 (18.6) 506 (14.5) 3452 (15.4)
Other/Unknown 4934 ( 4.1) 3579 ( 2.8) 191 ( 5.5) 1056 ( 4.7)
physicianSpeciality2 (%) Critical Care 26125 (21.9) 44415 (34.6) 1099 (31.5) 8656 (38.7)
Speciality-Other 93313 (78.1) 84034 (65.4) 2393 (68.5) 13717 (61.3)
icu_admit_source2 (%) Floor 17596 (14.7) 21717 (16.9) 962 (27.5) 6159 (27.5)
OR/Proc Area 22718 (19.0) 28244 (22.0) 261 ( 7.5) 1708 ( 7.6)
Direct Admit 15459 (12.9) 10957 ( 8.5) 518 (14.8) 2537 (11.3)
Emergency Department 60592 (50.7) 63812 (49.7) 1542 (44.2) 10728 (48.0)
Other 955 ( 0.8) 1040 ( 0.8) 63 ( 1.8) 302 ( 1.3)
Step-Down Unit 2118 ( 1.8) 2679 ( 2.1) 146 ( 4.2) 939 ( 4.2)
icu_disch_location2 (%) Floor 88826 (74.4) 103482 (80.6) 1415 (40.5) 5696 (25.5)
Death 0 ( 0.0) 0 ( 0.0) 1983 (56.8) 16372 (73.2)
Home 19229 (16.1) 7432 ( 5.8) 3 ( 0.1) 19 ( 0.1)
SNF/Rehab 1476 ( 1.2) 2780 ( 2.2) 0 ( 0.0) 2 ( 0.0)
Other 3571 ( 3.0) 5115 ( 4.0) 23 ( 0.7) 96 ( 0.4)
Other Hospital 2457 ( 2.1) 3681 ( 2.9) 9 ( 0.3) 9 ( 0.0)
Step-Down Unit 3879 ( 3.2) 5959 ( 4.6) 59 ( 1.7) 179 ( 0.8)
hospitaldischargeyear (%) -2010 14311 (12.0) 15671 (12.2) 480 (13.7) 2886 (12.9)
2011 15532 (13.0) 17602 (13.7) 467 (13.4) 3213 (14.4)
2012 19360 (16.2) 21191 (16.5) 571 (16.4) 3688 (16.5)
2013 22159 (18.6) 23350 (18.2) 683 (19.6) 4070 (18.2)
2014 24018 (20.1) 24825 (19.3) 630 (18.0) 4078 (18.2)
2015-16 24058 (20.1) 25810 (20.1) 661 (18.9) 4438 (19.8)
dischargelocation (mean (sd)) 5.15 (1.65) 4.97 (1.62) 7.00 (2.42) 7.75 (2.15)
dialysis (%) 0 115245 (96.5) 124561 (97.0) 3281 (94.0) 21407 (95.7)
1 4193 ( 3.5) 3888 ( 3.0) 211 ( 6.0) 966 ( 4.3)
aids (%) 0 119343 (99.9) 128314 (99.9) 3486 (99.8) 22346 (99.9)
1 95 ( 0.1) 135 ( 0.1) 6 ( 0.2) 27 ( 0.1)
hepaticfailure (%) FALSE 117974 (98.8) 125189 (97.5) 3435 (98.4) 21473 (96.0)
TRUE 1464 ( 1.2) 3260 ( 2.5) 57 ( 1.6) 900 ( 4.0)
diabetes (%) 0 89700 (75.1) 103164 (80.3) 2498 (71.5) 18558 (82.9)
1 29738 (24.9) 25285 (19.7) 994 (28.5) 3815 (17.1)
immunosuppression (%) 0 117440 (98.3) 125151 (97.4) 3364 (96.3) 21431 (95.8)
1 1998 ( 1.7) 3298 ( 2.6) 128 ( 3.7) 942 ( 4.2)
leukemia (%) 0 118868 (99.5) 127465 (99.2) 3450 (98.8) 22031 (98.5)
1 570 ( 0.5) 984 ( 0.8) 42 ( 1.2) 342 ( 1.5)
lymphoma (%) 0 119099 (99.7) 127925 (99.6) 3468 (99.3) 22230 (99.4)
1 339 ( 0.3) 524 ( 0.4) 24 ( 0.7) 143 ( 0.6)
metastaticcancer (%) 0 117589 (98.5) 125946 (98.1) 3389 (97.1) 21522 (96.2)
1 1849 ( 1.5) 2503 ( 1.9) 103 ( 2.9) 851 ( 3.8)
thrombolytics (%) 0 116194 (97.3) 127129 (99.0) 3444 (98.6) 22017 (98.4)
1 3244 ( 2.7) 1320 ( 1.0) 48 ( 1.4) 356 ( 1.6)
sofa_respiration_baseline2 (%) FALSE 95583 (80.0) 93864 (73.1) 2514 (72.0) 16047 (71.7)
TRUE 23855 (20.0) 34585 (26.9) 978 (28.0) 6326 (28.3)
sofa_liver_baseline2 (%) FALSE 117974 (98.8) 125189 (97.5) 3435 (98.4) 21473 (96.0)
TRUE 1464 ( 1.2) 3260 ( 2.5) 57 ( 1.6) 900 ( 4.0)
sofa_renal_baseline2 (%) FALSE 115245 (96.5) 124561 (97.0) 3281 (94.0) 21407 (95.7)
TRUE 4193 ( 3.5) 3888 ( 3.0) 211 ( 6.0) 966 ( 4.3)
cardiovascular_baseline (%) 0 93442 (78.2) 99666 (77.6) 2390 (68.4) 16363 (73.1)
1 25996 (21.8) 28783 (22.4) 1102 (31.6) 6010 (26.9)
group (%) Cardiovascular 46150 (38.6) 34815 (27.1) 883 (25.3) 6515 (29.1)
Gastrointestinal 10652 ( 8.9) 15613 (12.2) 193 ( 5.5) 2086 ( 9.3)
Gynaecological 247 ( 0.2) 459 ( 0.4) 1 ( 0.0) 8 ( 0.0)
Hematological 852 ( 0.7) 1063 ( 0.8) 22 ( 0.6) 149 ( 0.7)
Metabolic 11088 ( 9.3) 10941 ( 8.5) 58 ( 1.7) 374 ( 1.7)
Muscoskeletal/Skin disease 1538 ( 1.3) 1794 ( 1.4) 16 ( 0.5) 110 ( 0.5)
Neurological 21786 (18.2) 11714 ( 9.1) 1048 (30.0) 2289 (10.2)
Renal/Genitourinary 2731 ( 2.3) 3370 ( 2.6) 60 ( 1.7) 415 ( 1.9)
Respiratory 13352 (11.2) 22364 (17.4) 784 (22.5) 4358 (19.5)
Sepsis 4077 ( 3.4) 19956 (15.5) 242 ( 6.9) 5062 (22.6)
Trauma 5785 ( 4.8) 5411 ( 4.2) 140 ( 4.0) 789 ( 3.5)
Undefined 1180 ( 1.0) 949 ( 0.7) 45 ( 1.3) 218 ( 1.0)
library(tidyr)
ssd_incl_te%>% group_by(gender2=="Male",FuzzyLogicTruthMort) %>%summarise(n=n())%>%spread(FuzzyLogicTruthMort,n)%>%mutate(SENS=TRUE.TRUE/(TRUE.TRUE+FALSE.TRUE),SPEC=FALSE.FALSE/(FALSE.FALSE+TRUE.FALSE))%>%knitr::kable()
gender2 == “Male” FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE SENS SPEC
FALSE 53508 61091 1646 10605 0.8656436 0.4669151
TRUE 65930 67358 1846 11768 0.8644043 0.4946432
ssd_incl_te%>% group_by(ethnicity2,FuzzyLogicTruthMort) %>%summarise(n=n())%>%spread(FuzzyLogicTruthMort,n)%>%mutate(SENS=TRUE.TRUE/(TRUE.TRUE+FALSE.TRUE),SPEC=FALSE.FALSE/(FALSE.FALSE+TRUE.FALSE))%>%knitr::kable()
ethnicity2 FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE SENS SPEC
Caucasian 89699 99090 2680 17219 0.8653199 0.4751283
African American 15185 13765 393 2386 0.8585822 0.5245250
Hispanic 5262 5835 137 1051 0.8846801 0.4741822
Asian 1590 1581 53 309 0.8535912 0.5014191
Native American 865 969 19 159 0.8932584 0.4716467
Other/Unknown 6837 7209 210 1249 0.8560658 0.4867578
ssd_incl_te%>% group_by(icu_admit_source2,FuzzyLogicTruthMort) %>%summarise(n=n())%>%spread(FuzzyLogicTruthMort,n)%>%mutate(SENS=TRUE.TRUE/(TRUE.TRUE+FALSE.TRUE),SPEC=FALSE.FALSE/(FALSE.FALSE+TRUE.FALSE))%>%knitr::kable()
icu_admit_source2 FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE SENS SPEC
Floor 17596 21717 962 6159 0.8649066 0.4475873
OR/Proc Area 22718 28244 261 1708 0.8674454 0.4457831
Direct Admit 15459 10957 518 2537 0.8304419 0.5852135
Emergency Department 60592 63812 1542 10728 0.8743276 0.4870583
Other 955 1040 63 302 0.8273973 0.4786967
Step-Down Unit 2118 2679 146 939 0.8654378 0.4415260

21 Baseline Sepsis Test/Train

Baseline_Sepsis_tr<-glm(sepsis_outcome ~ age_Ranges + gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + hospital_teaching_status + hospital_size + physicianSpeciality2 + hospitaldischargeyear + dialysis + aids + hepaticfailure  + diabetes + immunosuppression + leukemia + lymphoma + metastaticcancer + thrombolytics + sofa_respiration_baseline2 + cardiovascular_baseline, data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(Baseline_Sepsis_tr)
#sjt.glm(Baseline_Sepsis_tr)

#drop1(Baseline_Sepsis_tr,test="Chisq")



summary(Baseline_Sepsis_tr)
## 
## Call:
## glm(formula = sepsis_outcome ~ age_Ranges + gender2 + ethnicity2 + 
##     BMI_Ranges + icu_admit_source2 + hospital_teaching_status + 
##     hospital_size + physicianSpeciality2 + hospitaldischargeyear + 
##     dialysis + aids + hepaticfailure + diabetes + immunosuppression + 
##     leukemia + lymphoma + metastaticcancer + thrombolytics + 
##     sofa_respiration_baseline2 + cardiovascular_baseline, family = "binomial", 
##     data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.0071  -0.7316  -0.5589  -0.2665   3.3612  
## 
## Coefficients:
##                                        Estimate Std. Error  z value
## (Intercept)                           -0.948952   0.032059  -29.600
## age_Ranges(25,35]                      0.157222   0.026835    5.859
## age_Ranges(35,45]                      0.305391   0.024934   12.248
## age_Ranges(45,55]                      0.480932   0.023066   20.851
## age_Ranges(55,65]                      0.664639   0.022559   29.463
## age_Ranges(65,75]                      0.718137   0.022549   31.849
## age_Ranges(75,85]                      0.801259   0.022662   35.357
## age_Ranges(85,100]                     0.934297   0.023815   39.232
## gender2Female                          0.055373   0.006581    8.414
## gender2Other/Unknown                  -0.933627   0.263338   -3.545
## ethnicity2African American            -0.095562   0.010658   -8.966
## ethnicity2Hispanic                     0.395323   0.014683   26.923
## ethnicity2Asian                        0.083708   0.028682    2.918
## ethnicity2Native American              0.322652   0.036496    8.841
## ethnicity2Other/Unknown                0.073306   0.014404    5.089
## BMI_Ranges(18.5,25]                   -0.259430   0.014657  -17.700
## BMI_Ranges(25,35]                     -0.346922   0.014359  -24.160
## BMI_Ranges(35,200]                    -0.142435   0.015579   -9.143
## BMI_RangesOther/Unknown               -0.604858   0.022942  -26.364
## icu_admit_source2OR/Proc Area         -1.957638   0.014310 -136.805
## icu_admit_source2Direct Admit         -0.619162   0.012410  -49.891
## icu_admit_source2Emergency Department -0.320082   0.008116  -39.439
## icu_admit_source2Other                -0.188787   0.032393   -5.828
## icu_admit_source2Step-Down Unit        0.033255   0.020519    1.621
## hospital_teaching_statusf             -0.211799   0.023996   -8.827
## hospital_teaching_statust             -0.161197   0.024168   -6.670
## hospital_size<100                      0.537067   0.022878   23.476
## hospital_size100-249                   0.273145   0.018688   14.616
## hospital_size250-500                   0.262396   0.019027   13.791
## hospital_size>500                      0.124338   0.017769    6.997
## physicianSpeciality2Speciality-Other  -0.640748   0.007362  -87.036
## hospitaldischargeyear2011              0.100206   0.012669    7.910
## hospitaldischargeyear2012             -0.043243   0.012306   -3.514
## hospitaldischargeyear2013             -0.050617   0.012027   -4.208
## hospitaldischargeyear2014             -0.090001   0.011937   -7.540
## hospitaldischargeyear2015-16          -0.036695   0.011814   -3.106
## dialysis1                              0.246276   0.017038   14.455
## aids1                                  1.344545   0.084849   15.846
## hepaticfailureTRUE                     0.183669   0.020985    8.752
## diabetes1                             -0.074419   0.008111   -9.175
## immunosuppression1                     0.590598   0.019733   29.929
## leukemia1                              0.508674   0.032829   15.494
## lymphoma1                              0.411006   0.044722    9.190
## metastaticcancer1                      0.096858   0.023419    4.136
## thrombolytics1                        -2.219547   0.060013  -36.985
## sofa_respiration_baseline2TRUE         0.477844   0.007251   65.897
## cardiovascular_baseline1              -0.069130   0.007952   -8.694
##                                       Pr(>|z|)    
## (Intercept)                            < 2e-16 ***
## age_Ranges(25,35]                     4.66e-09 ***
## age_Ranges(35,45]                      < 2e-16 ***
## age_Ranges(45,55]                      < 2e-16 ***
## age_Ranges(55,65]                      < 2e-16 ***
## age_Ranges(65,75]                      < 2e-16 ***
## age_Ranges(75,85]                      < 2e-16 ***
## age_Ranges(85,100]                     < 2e-16 ***
## gender2Female                          < 2e-16 ***
## gender2Other/Unknown                  0.000392 ***
## ethnicity2African American             < 2e-16 ***
## ethnicity2Hispanic                     < 2e-16 ***
## ethnicity2Asian                       0.003518 ** 
## ethnicity2Native American              < 2e-16 ***
## ethnicity2Other/Unknown               3.59e-07 ***
## BMI_Ranges(18.5,25]                    < 2e-16 ***
## BMI_Ranges(25,35]                      < 2e-16 ***
## BMI_Ranges(35,200]                     < 2e-16 ***
## BMI_RangesOther/Unknown                < 2e-16 ***
## icu_admit_source2OR/Proc Area          < 2e-16 ***
## icu_admit_source2Direct Admit          < 2e-16 ***
## icu_admit_source2Emergency Department  < 2e-16 ***
## icu_admit_source2Other                5.61e-09 ***
## icu_admit_source2Step-Down Unit       0.105083    
## hospital_teaching_statusf              < 2e-16 ***
## hospital_teaching_statust             2.56e-11 ***
## hospital_size<100                      < 2e-16 ***
## hospital_size100-249                   < 2e-16 ***
## hospital_size250-500                   < 2e-16 ***
## hospital_size>500                     2.61e-12 ***
## physicianSpeciality2Speciality-Other   < 2e-16 ***
## hospitaldischargeyear2011             2.58e-15 ***
## hospitaldischargeyear2012             0.000442 ***
## hospitaldischargeyear2013             2.57e-05 ***
## hospitaldischargeyear2014             4.72e-14 ***
## hospitaldischargeyear2015-16          0.001895 ** 
## dialysis1                              < 2e-16 ***
## aids1                                  < 2e-16 ***
## hepaticfailureTRUE                     < 2e-16 ***
## diabetes1                              < 2e-16 ***
## immunosuppression1                     < 2e-16 ***
## leukemia1                              < 2e-16 ***
## lymphoma1                              < 2e-16 ***
## metastaticcancer1                     3.54e-05 ***
## thrombolytics1                         < 2e-16 ***
## sofa_respiration_baseline2TRUE         < 2e-16 ***
## cardiovascular_baseline1               < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 647128  on 638756  degrees of freedom
## Residual deviance: 590208  on 638710  degrees of freedom
## AIC: 590302
## 
## Number of Fisher Scoring iterations: 6
nrow(ssd_incl_te)
## [1] 273752
ssd_incl_te$BaselineSepsisPred <- predict(Baseline_Sepsis_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")
library(sjPlot)
library(ROCR)

BaselineSepsis.Pred <- prediction(ssd_incl_te$BaselineSepsisPred, ssd_incl_te$sepsis_outcome)
BaselineSepsis.Perf <- performance(BaselineSepsis.Pred, "tpr", "fpr")
plot(BaselineSepsis.Perf, main = "Baseline Sepsis 
     Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(BaselineSepsis.Pred,"auc")@y.values[[1]],3))) 

performance(BaselineSepsis.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.7078539
## 
## 
## Slot "alpha.values":
## list()
BaselineSepsis.Pred.roc <- roc(sepsis_outcome~BaselineSepsisPred,data=ssd_incl_te)
try({ci(BaselineSepsis.Pred.roc, conf.level=0.99)},silent=TRUE)
## 99% CI: 0.7049-0.7108 (DeLong)
ggplot(calibration(as.factor(!sepsis_outcome)~BaselineSepsisPred, data = ssd_incl_te))+ggtitle("Calibration of Baseline Sepsis Prediction")
## Warning: Removed 1 rows containing missing values (geom_errorbar).

qplot(BaselineSepsisPred, data = ssd_incl_te)+ggtitle("Histogram of Baseline Sepsis Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

22 Cross validation

partitions the data into 5 groups and then uses the 4 groups to predict the 5th group. It does this 5 times and then takes the average, ROC curves,

SIRS1_ADJ_Sepsis_tr<-glm(sepsis_outcome ~ as.factor(SIRS_total) + age_Ranges + gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + hospital_teaching_status + hospital_size + physicianSpeciality2 + hospitaldischargeyear + dialysis + aids + hepaticfailure  + diabetes + immunosuppression + leukemia + lymphoma + metastaticcancer + thrombolytics + sofa_respiration_baseline2 + cardiovascular_baseline, data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(SIRS1_ADJ_Sepsis_tr)
#sjt.glm(SIRS1_ADJ_Sepsis_tr)

#drop1(SIRS1_ADJ_Sepsis_tr,test="Chisq")

summary(SIRS1_ADJ_Sepsis_tr)
## 
## Call:
## glm(formula = sepsis_outcome ~ as.factor(SIRS_total) + age_Ranges + 
##     gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + hospital_teaching_status + 
##     hospital_size + physicianSpeciality2 + hospitaldischargeyear + 
##     dialysis + aids + hepaticfailure + diabetes + immunosuppression + 
##     leukemia + lymphoma + metastaticcancer + thrombolytics + 
##     sofa_respiration_baseline2 + cardiovascular_baseline, family = "binomial", 
##     data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.1495  -0.7000  -0.4704  -0.2145   3.5849  
## 
## Coefficients:
##                                        Estimate Std. Error  z value
## (Intercept)                           -2.429719   0.039665  -61.257
## as.factor(SIRS_total)1                 0.436152   0.023983   18.186
## as.factor(SIRS_total)2                 0.940994   0.022745   41.372
## as.factor(SIRS_total)3                 1.609766   0.022686   70.960
## as.factor(SIRS_total)4                 2.123455   0.023522   90.276
## age_Ranges(25,35]                      0.172778   0.027345    6.318
## age_Ranges(35,45]                      0.349355   0.025416   13.745
## age_Ranges(45,55]                      0.561817   0.023515   23.892
## age_Ranges(55,65]                      0.758603   0.023001   32.981
## age_Ranges(65,75]                      0.825533   0.022998   35.895
## age_Ranges(75,85]                      0.918961   0.023125   39.738
## age_Ranges(85,100]                     1.060331   0.024332   43.578
## gender2Female                          0.047199   0.006766    6.976
## gender2Other/Unknown                  -1.227754   0.268623   -4.571
## ethnicity2African American            -0.075559   0.010939   -6.907
## ethnicity2Hispanic                     0.423319   0.015132   27.976
## ethnicity2Asian                        0.077548   0.029551    2.624
## ethnicity2Native American              0.299836   0.037605    7.973
## ethnicity2Other/Unknown                0.074933   0.014816    5.058
## BMI_Ranges(18.5,25]                   -0.223233   0.015089  -14.795
## BMI_Ranges(25,35]                     -0.287623   0.014782  -19.457
## BMI_Ranges(35,200]                    -0.087281   0.016028   -5.445
## BMI_RangesOther/Unknown               -0.474443   0.023598  -20.106
## icu_admit_source2OR/Proc Area         -2.013520   0.014539 -138.490
## icu_admit_source2Direct Admit         -0.545531   0.012789  -42.657
## icu_admit_source2Emergency Department -0.231184   0.008369  -27.623
## icu_admit_source2Other                -0.210439   0.033315   -6.317
## icu_admit_source2Step-Down Unit       -0.007810   0.021107   -0.370
## hospital_teaching_statusf             -0.244631   0.024645   -9.926
## hospital_teaching_statust             -0.207217   0.024870   -8.332
## hospital_size<100                      0.667845   0.023520   28.395
## hospital_size100-249                   0.333243   0.019163   17.390
## hospital_size250-500                   0.254919   0.019497   13.075
## hospital_size>500                      0.119283   0.018237    6.541
## physicianSpeciality2Speciality-Other  -0.517197   0.007584  -68.200
## hospitaldischargeyear2011              0.086893   0.013067    6.650
## hospitaldischargeyear2012             -0.057270   0.012681   -4.516
## hospitaldischargeyear2013             -0.056253   0.012392   -4.539
## hospitaldischargeyear2014             -0.078709   0.012296   -6.401
## hospitaldischargeyear2015-16          -0.040295   0.012168   -3.311
## dialysis1                              0.280215   0.017545   15.972
## aids1                                  1.262548   0.087496   14.430
## hepaticfailureTRUE                     0.166797   0.021570    7.733
## diabetes1                             -0.064800   0.008329   -7.780
## immunosuppression1                     0.512198   0.020312   25.217
## leukemia1                              0.332608   0.033869    9.821
## lymphoma1                              0.335520   0.046166    7.268
## metastaticcancer1                      0.035127   0.024025    1.462
## thrombolytics1                        -2.191144   0.060462  -36.240
## sofa_respiration_baseline2TRUE         0.447371   0.007468   59.904
## cardiovascular_baseline1              -0.012943   0.008184   -1.581
##                                       Pr(>|z|)    
## (Intercept)                            < 2e-16 ***
## as.factor(SIRS_total)1                 < 2e-16 ***
## as.factor(SIRS_total)2                 < 2e-16 ***
## as.factor(SIRS_total)3                 < 2e-16 ***
## as.factor(SIRS_total)4                 < 2e-16 ***
## age_Ranges(25,35]                     2.64e-10 ***
## age_Ranges(35,45]                      < 2e-16 ***
## age_Ranges(45,55]                      < 2e-16 ***
## age_Ranges(55,65]                      < 2e-16 ***
## age_Ranges(65,75]                      < 2e-16 ***
## age_Ranges(75,85]                      < 2e-16 ***
## age_Ranges(85,100]                     < 2e-16 ***
## gender2Female                         3.03e-12 ***
## gender2Other/Unknown                  4.86e-06 ***
## ethnicity2African American            4.95e-12 ***
## ethnicity2Hispanic                     < 2e-16 ***
## ethnicity2Asian                       0.008685 ** 
## ethnicity2Native American             1.54e-15 ***
## ethnicity2Other/Unknown               4.24e-07 ***
## BMI_Ranges(18.5,25]                    < 2e-16 ***
## BMI_Ranges(25,35]                      < 2e-16 ***
## BMI_Ranges(35,200]                    5.17e-08 ***
## BMI_RangesOther/Unknown                < 2e-16 ***
## icu_admit_source2OR/Proc Area          < 2e-16 ***
## icu_admit_source2Direct Admit          < 2e-16 ***
## icu_admit_source2Emergency Department  < 2e-16 ***
## icu_admit_source2Other                2.67e-10 ***
## icu_admit_source2Step-Down Unit       0.711369    
## hospital_teaching_statusf              < 2e-16 ***
## hospital_teaching_statust              < 2e-16 ***
## hospital_size<100                      < 2e-16 ***
## hospital_size100-249                   < 2e-16 ***
## hospital_size250-500                   < 2e-16 ***
## hospital_size>500                     6.12e-11 ***
## physicianSpeciality2Speciality-Other   < 2e-16 ***
## hospitaldischargeyear2011             2.94e-11 ***
## hospitaldischargeyear2012             6.29e-06 ***
## hospitaldischargeyear2013             5.64e-06 ***
## hospitaldischargeyear2014             1.54e-10 ***
## hospitaldischargeyear2015-16          0.000928 ***
## dialysis1                              < 2e-16 ***
## aids1                                  < 2e-16 ***
## hepaticfailureTRUE                    1.05e-14 ***
## diabetes1                             7.28e-15 ***
## immunosuppression1                     < 2e-16 ***
## leukemia1                              < 2e-16 ***
## lymphoma1                             3.66e-13 ***
## metastaticcancer1                     0.143703    
## thrombolytics1                         < 2e-16 ***
## sofa_respiration_baseline2TRUE         < 2e-16 ***
## cardiovascular_baseline1              0.113769    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 647128  on 638756  degrees of freedom
## Residual deviance: 560649  on 638706  degrees of freedom
## AIC: 560751
## 
## Number of Fisher Scoring iterations: 6
ssd_incl_te$SIRS1ADJSepsisPred <- predict(SIRS1_ADJ_Sepsis_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")
library(sjPlot)
library(ROCR)

SIRS1ADJSepsis.Pred <- prediction(ssd_incl_te$SIRS1ADJSepsisPred, ssd_incl_te$sepsis_outcome)
SIRS1ADJSepsis.Perf <- performance(SIRS1ADJSepsis.Pred, "tpr", "fpr")
plot(SIRS1ADJSepsis.Perf, main = "SIRS Total Adjusted 
     Sepsis Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(SIRS1ADJSepsis.Pred,"auc")@y.values[[1]],3))) 

performance(SIRS1ADJSepsis.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.7553989
## 
## 
## Slot "alpha.values":
## list()
SIRS1ADJSepsis.Pred.roc <- roc(sepsis_outcome~SIRS1ADJSepsisPred,data=ssd_incl_te)
ci(SIRS1ADJSepsis.Pred.roc, conf.level=0.99)
## 99% CI: 0.7526-0.7582 (DeLong)
ggplot(calibration(as.factor(!sepsis_outcome)~SIRS1ADJSepsisPred, data = ssd_incl_te))+ggtitle("Calibration of SIRS Total Sepsis Prediction")
## Warning: Removed 1 rows containing missing values (geom_errorbar).

qplot(SIRS1ADJSepsisPred, data = ssd_incl_te)+ggtitle("Histogram of SIRS Total Sepsis Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

SIRS2_ADJ_Sepsis_tr<-glm(sepsis_outcome ~ as.factor(SIRS_Positive) + age_Ranges + gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + hospital_teaching_status + hospital_size + physicianSpeciality2 + hospitaldischargeyear + dialysis + aids + hepaticfailure  + diabetes + immunosuppression + leukemia + lymphoma + metastaticcancer + thrombolytics + sofa_respiration_baseline2 + cardiovascular_baseline, data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(SIRS2_ADJ_Sepsis_tr)
#sjt.glm(SIRS2_ADJ_Sepsis_tr)

#drop1(SIRS2_ADJ_Sepsis_tr,test="Chisq")

summary(SIRS2_ADJ_Sepsis_tr)
## 
## Call:
## glm(formula = sepsis_outcome ~ as.factor(SIRS_Positive) + age_Ranges + 
##     gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + hospital_teaching_status + 
##     hospital_size + physicianSpeciality2 + hospitaldischargeyear + 
##     dialysis + aids + hepaticfailure + diabetes + immunosuppression + 
##     leukemia + lymphoma + metastaticcancer + thrombolytics + 
##     sofa_respiration_baseline2 + cardiovascular_baseline, family = "binomial", 
##     data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.9803  -0.7421  -0.4828  -0.2363   3.5802  
## 
## Coefficients:
##                                        Estimate Std. Error  z value
## (Intercept)                           -1.936435   0.033653  -57.542
## as.factor(SIRS_Positive)TRUE           1.048040   0.009609  109.071
## age_Ranges(25,35]                      0.162463   0.026974    6.023
## age_Ranges(35,45]                      0.327205   0.025070   13.052
## age_Ranges(45,55]                      0.530769   0.023195   22.883
## age_Ranges(55,65]                      0.730340   0.022688   32.191
## age_Ranges(65,75]                      0.789052   0.022681   34.790
## age_Ranges(75,85]                      0.874976   0.022801   38.374
## age_Ranges(85,100]                     1.002089   0.023981   41.787
## gender2Female                          0.044010   0.006658    6.610
## gender2Other/Unknown                  -1.004654   0.264674   -3.796
## ethnicity2African American            -0.092363   0.010769   -8.577
## ethnicity2Hispanic                     0.414171   0.014891   27.813
## ethnicity2Asian                        0.085743   0.029042    2.952
## ethnicity2Native American              0.317633   0.036965    8.593
## ethnicity2Other/Unknown                0.082246   0.014582    5.640
## BMI_Ranges(18.5,25]                   -0.232734   0.014828  -15.695
## BMI_Ranges(25,35]                     -0.300477   0.014528  -20.682
## BMI_Ranges(35,200]                    -0.099830   0.015759   -6.335
## BMI_RangesOther/Unknown               -0.524068   0.023235  -22.555
## icu_admit_source2OR/Proc Area         -1.959456   0.014380 -136.259
## icu_admit_source2Direct Admit         -0.558916   0.012569  -44.469
## icu_admit_source2Emergency Department -0.271484   0.008222  -33.021
## icu_admit_source2Other                -0.190686   0.032700   -5.831
## icu_admit_source2Step-Down Unit        0.017408   0.020719    0.840
## hospital_teaching_statusf             -0.253374   0.024258  -10.445
## hospital_teaching_statust             -0.211064   0.024432   -8.639
## hospital_size<100                      0.612993   0.023172   26.455
## hospital_size100-249                   0.324457   0.018871   17.194
## hospital_size250-500                   0.284720   0.019202   14.828
## hospital_size>500                      0.150109   0.017929    8.373
## physicianSpeciality2Speciality-Other  -0.573496   0.007451  -76.974
## hospitaldischargeyear2011              0.085237   0.012839    6.639
## hospitaldischargeyear2012             -0.065207   0.012465   -5.231
## hospitaldischargeyear2013             -0.077513   0.012183   -6.362
## hospitaldischargeyear2014             -0.108178   0.012091   -8.947
## hospitaldischargeyear2015-16          -0.066888   0.011965   -5.591
## dialysis1                              0.265450   0.017262   15.378
## aids1                                  1.314977   0.085993   15.292
## hepaticfailureTRUE                     0.168457   0.021192    7.949
## diabetes1                             -0.071153   0.008198   -8.679
## immunosuppression1                     0.549108   0.019920   27.565
## leukemia1                              0.436945   0.033120   13.193
## lymphoma1                              0.379458   0.045234    8.389
## metastaticcancer1                      0.053638   0.023601    2.273
## thrombolytics1                        -2.158174   0.060174  -35.866
## sofa_respiration_baseline2TRUE         0.433702   0.007344   59.057
## cardiovascular_baseline1              -0.040490   0.008057   -5.025
##                                       Pr(>|z|)    
## (Intercept)                            < 2e-16 ***
## as.factor(SIRS_Positive)TRUE           < 2e-16 ***
## age_Ranges(25,35]                     1.71e-09 ***
## age_Ranges(35,45]                      < 2e-16 ***
## age_Ranges(45,55]                      < 2e-16 ***
## age_Ranges(55,65]                      < 2e-16 ***
## age_Ranges(65,75]                      < 2e-16 ***
## age_Ranges(75,85]                      < 2e-16 ***
## age_Ranges(85,100]                     < 2e-16 ***
## gender2Female                         3.85e-11 ***
## gender2Other/Unknown                  0.000147 ***
## ethnicity2African American             < 2e-16 ***
## ethnicity2Hispanic                     < 2e-16 ***
## ethnicity2Asian                       0.003153 ** 
## ethnicity2Native American              < 2e-16 ***
## ethnicity2Other/Unknown               1.70e-08 ***
## BMI_Ranges(18.5,25]                    < 2e-16 ***
## BMI_Ranges(25,35]                      < 2e-16 ***
## BMI_Ranges(35,200]                    2.38e-10 ***
## BMI_RangesOther/Unknown                < 2e-16 ***
## icu_admit_source2OR/Proc Area          < 2e-16 ***
## icu_admit_source2Direct Admit          < 2e-16 ***
## icu_admit_source2Emergency Department  < 2e-16 ***
## icu_admit_source2Other                5.50e-09 ***
## icu_admit_source2Step-Down Unit       0.400795    
## hospital_teaching_statusf              < 2e-16 ***
## hospital_teaching_statust              < 2e-16 ***
## hospital_size<100                      < 2e-16 ***
## hospital_size100-249                   < 2e-16 ***
## hospital_size250-500                   < 2e-16 ***
## hospital_size>500                      < 2e-16 ***
## physicianSpeciality2Speciality-Other   < 2e-16 ***
## hospitaldischargeyear2011             3.16e-11 ***
## hospitaldischargeyear2012             1.68e-07 ***
## hospitaldischargeyear2013             1.99e-10 ***
## hospitaldischargeyear2014              < 2e-16 ***
## hospitaldischargeyear2015-16          2.26e-08 ***
## dialysis1                              < 2e-16 ***
## aids1                                  < 2e-16 ***
## hepaticfailureTRUE                    1.88e-15 ***
## diabetes1                              < 2e-16 ***
## immunosuppression1                     < 2e-16 ***
## leukemia1                              < 2e-16 ***
## lymphoma1                              < 2e-16 ***
## metastaticcancer1                     0.023046 *  
## thrombolytics1                         < 2e-16 ***
## sofa_respiration_baseline2TRUE         < 2e-16 ***
## cardiovascular_baseline1              5.02e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 647128  on 638756  degrees of freedom
## Residual deviance: 576168  on 638709  degrees of freedom
## AIC: 576264
## 
## Number of Fisher Scoring iterations: 6
ssd_incl_te$SIRS2ADJSepsisPred <- predict(SIRS2_ADJ_Sepsis_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")
library(sjPlot)
library(ROCR)

SIRS2ADJSepsis.Pred <- prediction(ssd_incl_te$SIRS2ADJSepsisPred, ssd_incl_te$sepsis_outcome)
SIRS2ADJSepsis.Perf <- performance(SIRS2ADJSepsis.Pred, "tpr", "fpr")
plot(SIRS2ADJSepsis.Perf, main = "SIRS Positive Adjusted 
     Sepsis Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(SIRS2ADJSepsis.Pred,"auc")@y.values[[1]],3))) 

performance(SIRS2ADJSepsis.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.7303764
## 
## 
## Slot "alpha.values":
## list()
SIRS2ADJSepsis.Pred.roc <- roc(sepsis_outcome~SIRS2ADJSepsisPred,data=ssd_incl_te)
ci(SIRS2ADJSepsis.Pred.roc, conf.level=0.99)
## 99% CI: 0.7275-0.7332 (DeLong)
ggplot(calibration(as.factor(!sepsis_outcome)~SIRS2ADJSepsisPred, data = ssd_incl_te))+ggtitle("Calibration of SIRS Positive Sepsis Prediction")
## Warning: Removed 1 rows containing missing values (geom_errorbar).

qplot(SIRS2ADJSepsisPred, data = ssd_incl_te)+ggtitle("Histogram of SIRS Positive Sepsis Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

qSOFA1_ADJ_Sepsis_tr<-glm(sepsis_outcome ~ as.factor(qSOFA_total) + age_Ranges + gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + hospital_teaching_status + hospital_size + physicianSpeciality2 + hospitaldischargeyear + dialysis + aids + hepaticfailure  + diabetes + immunosuppression + leukemia + lymphoma + metastaticcancer + thrombolytics + sofa_respiration_baseline2 + cardiovascular_baseline, data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(qSOFA1_ADJ_Sepsis_tr)
#sjt.glm(qSOFA1_ADJ_Sepsis_tr)

#drop1(qSOFA1_ADJ_Sepsis_tr,test="Chisq")

summary(qSOFA1_ADJ_Sepsis_tr)
## 
## Call:
## glm(formula = sepsis_outcome ~ as.factor(qSOFA_total) + age_Ranges + 
##     gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + hospital_teaching_status + 
##     hospital_size + physicianSpeciality2 + hospitaldischargeyear + 
##     dialysis + aids + hepaticfailure + diabetes + immunosuppression + 
##     leukemia + lymphoma + metastaticcancer + thrombolytics + 
##     sofa_respiration_baseline2 + cardiovascular_baseline, family = "binomial", 
##     data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.1636  -0.7142  -0.4937  -0.2294   3.4145  
## 
## Coefficients:
##                                        Estimate Std. Error  z value
## (Intercept)                           -2.210126   0.037877  -58.349
## as.factor(qSOFA_total)1                0.644273   0.020786   30.996
## as.factor(qSOFA_total)2                1.163153   0.020020   58.098
## as.factor(qSOFA_total)3                1.772241   0.020300   87.301
## age_Ranges(25,35]                      0.167541   0.027182    6.164
## age_Ranges(35,45]                      0.307748   0.025266   12.180
## age_Ranges(45,55]                      0.463480   0.023372   19.830
## age_Ranges(55,65]                      0.637824   0.022859   27.902
## age_Ranges(65,75]                      0.675474   0.022849   29.563
## age_Ranges(75,85]                      0.729479   0.022964   31.767
## age_Ranges(85,100]                     0.808471   0.024149   33.479
## gender2Female                          0.031488   0.006702    4.698
## gender2Other/Unknown                  -1.048583   0.266049   -3.941
## ethnicity2African American            -0.056398   0.010855   -5.195
## ethnicity2Hispanic                     0.442768   0.014988   29.541
## ethnicity2Asian                        0.088790   0.029224    3.038
## ethnicity2Native American              0.269451   0.037163    7.251
## ethnicity2Other/Unknown                0.098057   0.014689    6.675
## BMI_Ranges(18.5,25]                   -0.213684   0.014944  -14.299
## BMI_Ranges(25,35]                     -0.259585   0.014649  -17.721
## BMI_Ranges(35,200]                    -0.059729   0.015896   -3.758
## BMI_RangesOther/Unknown               -0.518174   0.023360  -22.182
## icu_admit_source2OR/Proc Area         -1.897887   0.014444 -131.398
## icu_admit_source2Direct Admit         -0.543341   0.012658  -42.925
## icu_admit_source2Emergency Department -0.260007   0.008287  -31.376
## icu_admit_source2Other                -0.205693   0.032990   -6.235
## icu_admit_source2Step-Down Unit        0.002663   0.020917    0.127
## hospital_teaching_statusf             -0.336939   0.024412  -13.802
## hospital_teaching_statust             -0.305396   0.024511  -12.459
## hospital_size<100                      0.775406   0.023350   33.208
## hospital_size100-249                   0.444667   0.019011   23.391
## hospital_size250-500                   0.390689   0.019337   20.205
## hospital_size>500                      0.230553   0.017992   12.814
## physicianSpeciality2Speciality-Other  -0.534023   0.007509  -71.116
## hospitaldischargeyear2011              0.064268   0.012930    4.970
## hospitaldischargeyear2012             -0.105120   0.012561   -8.369
## hospitaldischargeyear2013             -0.105697   0.012273   -8.612
## hospitaldischargeyear2014             -0.133086   0.012179  -10.928
## hospitaldischargeyear2015-16          -0.098864   0.012056   -8.200
## dialysis1                              0.234254   0.017422   13.446
## aids1                                  1.322708   0.086976   15.208
## hepaticfailureTRUE                     0.099746   0.021374    4.667
## diabetes1                             -0.050246   0.008274   -6.073
## immunosuppression1                     0.619986   0.020126   30.806
## leukemia1                              0.501722   0.033508   14.973
## lymphoma1                              0.414851   0.045777    9.062
## metastaticcancer1                      0.075231   0.023838    3.156
## thrombolytics1                        -2.156666   0.060254  -35.793
## sofa_respiration_baseline2TRUE         0.451352   0.007391   61.071
## cardiovascular_baseline1              -0.075059   0.008102   -9.265
##                                       Pr(>|z|)    
## (Intercept)                            < 2e-16 ***
## as.factor(qSOFA_total)1                < 2e-16 ***
## as.factor(qSOFA_total)2                < 2e-16 ***
## as.factor(qSOFA_total)3                < 2e-16 ***
## age_Ranges(25,35]                     7.11e-10 ***
## age_Ranges(35,45]                      < 2e-16 ***
## age_Ranges(45,55]                      < 2e-16 ***
## age_Ranges(55,65]                      < 2e-16 ***
## age_Ranges(65,75]                      < 2e-16 ***
## age_Ranges(75,85]                      < 2e-16 ***
## age_Ranges(85,100]                     < 2e-16 ***
## gender2Female                         2.62e-06 ***
## gender2Other/Unknown                  8.10e-05 ***
## ethnicity2African American            2.04e-07 ***
## ethnicity2Hispanic                     < 2e-16 ***
## ethnicity2Asian                       0.002380 ** 
## ethnicity2Native American             4.15e-13 ***
## ethnicity2Other/Unknown               2.47e-11 ***
## BMI_Ranges(18.5,25]                    < 2e-16 ***
## BMI_Ranges(25,35]                      < 2e-16 ***
## BMI_Ranges(35,200]                    0.000172 ***
## BMI_RangesOther/Unknown                < 2e-16 ***
## icu_admit_source2OR/Proc Area          < 2e-16 ***
## icu_admit_source2Direct Admit          < 2e-16 ***
## icu_admit_source2Emergency Department  < 2e-16 ***
## icu_admit_source2Other                4.52e-10 ***
## icu_admit_source2Step-Down Unit       0.898706    
## hospital_teaching_statusf              < 2e-16 ***
## hospital_teaching_statust              < 2e-16 ***
## hospital_size<100                      < 2e-16 ***
## hospital_size100-249                   < 2e-16 ***
## hospital_size250-500                   < 2e-16 ***
## hospital_size>500                      < 2e-16 ***
## physicianSpeciality2Speciality-Other   < 2e-16 ***
## hospitaldischargeyear2011             6.68e-07 ***
## hospitaldischargeyear2012              < 2e-16 ***
## hospitaldischargeyear2013              < 2e-16 ***
## hospitaldischargeyear2014              < 2e-16 ***
## hospitaldischargeyear2015-16          2.40e-16 ***
## dialysis1                              < 2e-16 ***
## aids1                                  < 2e-16 ***
## hepaticfailureTRUE                    3.06e-06 ***
## diabetes1                             1.26e-09 ***
## immunosuppression1                     < 2e-16 ***
## leukemia1                              < 2e-16 ***
## lymphoma1                              < 2e-16 ***
## metastaticcancer1                     0.001600 ** 
## thrombolytics1                         < 2e-16 ***
## sofa_respiration_baseline2TRUE         < 2e-16 ***
## cardiovascular_baseline1               < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 647128  on 638756  degrees of freedom
## Residual deviance: 570280  on 638707  degrees of freedom
## AIC: 570380
## 
## Number of Fisher Scoring iterations: 6
ssd_incl_te$qSOFA1ADJSepsisPred <- predict(qSOFA1_ADJ_Sepsis_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")
library(sjPlot)
library(ROCR)

qSOFA1ADJSepsis.Pred <- prediction(ssd_incl_te$qSOFA1ADJSepsisPred, ssd_incl_te$sepsis_outcome)
qSOFA1ADJSepsis.Perf <- performance(qSOFA1ADJSepsis.Pred, "tpr", "fpr")
plot(qSOFA1ADJSepsis.Perf, main = "qSOFA1 Total Adjusted 
     Sepsis Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(qSOFA1ADJSepsis.Pred,"auc")@y.values[[1]],3))) 

performance(qSOFA1ADJSepsis.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.7409462
## 
## 
## Slot "alpha.values":
## list()
qSOFA1ADJSepsis.Pred.roc <- roc(sepsis_outcome~qSOFA1ADJSepsisPred,data=ssd_incl_te)
ci(qSOFA1ADJSepsis.Pred.roc, conf.level=0.99)
## 99% CI: 0.7381-0.7438 (DeLong)
ggplot(calibration(as.factor(!sepsis_outcome)~qSOFA1ADJSepsisPred, data = ssd_incl_te))+ggtitle("Calibration of qSOFA Total Sepsis Prediction")
## Warning: Removed 1 rows containing missing values (geom_errorbar).

qplot(qSOFA1ADJSepsisPred, data = ssd_incl_te)+ggtitle("Histogram of qSOFA Total Sepsis Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

qSOFA2_ADJ_Sepsis_tr<-glm(sepsis_outcome ~ as.factor(qSOFA_Positive) + age_Ranges + gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + hospital_teaching_status + hospital_size + physicianSpeciality2 + hospitaldischargeyear + dialysis + aids + hepaticfailure  + diabetes + immunosuppression + leukemia + lymphoma + metastaticcancer + thrombolytics + sofa_respiration_baseline2 + cardiovascular_baseline, data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(qSOFA2_ADJ_Sepsis_tr)
#sjt.glm(qSOFA2_ADJ_Sepsis_tr)

#drop1(qSOFA2_ADJ_Sepsis_tr,test="Chisq")

summary(qSOFA2_ADJ_Sepsis_tr)
## 
## Call:
## glm(formula = sepsis_outcome ~ as.factor(qSOFA_Positive) + age_Ranges + 
##     gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + hospital_teaching_status + 
##     hospital_size + physicianSpeciality2 + hospitaldischargeyear + 
##     dialysis + aids + hepaticfailure + diabetes + immunosuppression + 
##     leukemia + lymphoma + metastaticcancer + thrombolytics + 
##     sofa_respiration_baseline2 + cardiovascular_baseline, family = "binomial", 
##     data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.0393  -0.7351  -0.4970  -0.2318   3.4675  
## 
## Coefficients:
##                                        Estimate Std. Error  z value
## (Intercept)                           -1.613432   0.033040  -48.833
## as.factor(qSOFA_Positive)TRUE          0.858277   0.008067  106.392
## age_Ranges(25,35]                      0.166693   0.027053    6.162
## age_Ranges(35,45]                      0.309178   0.025142   12.297
## age_Ranges(45,55]                      0.467968   0.023255   20.124
## age_Ranges(55,65]                      0.647344   0.022744   28.463
## age_Ranges(65,75]                      0.689490   0.022732   30.331
## age_Ranges(75,85]                      0.755401   0.022845   33.067
## age_Ranges(85,100]                     0.860668   0.024010   35.846
## gender2Female                          0.034811   0.006652    5.233
## gender2Other/Unknown                  -0.987923   0.264232   -3.739
## ethnicity2African American            -0.057522   0.010779   -5.336
## ethnicity2Hispanic                     0.429726   0.014880   28.879
## ethnicity2Asian                        0.082931   0.028990    2.861
## ethnicity2Native American              0.295288   0.036883    8.006
## ethnicity2Other/Unknown                0.097719   0.014576    6.704
## BMI_Ranges(18.5,25]                   -0.233284   0.014814  -15.748
## BMI_Ranges(25,35]                     -0.294022   0.014518  -20.252
## BMI_Ranges(35,200]                    -0.089909   0.015757   -5.706
## BMI_RangesOther/Unknown               -0.549213   0.023181  -23.692
## icu_admit_source2OR/Proc Area         -1.926253   0.014386 -133.902
## icu_admit_source2Direct Admit         -0.568880   0.012550  -45.330
## icu_admit_source2Emergency Department -0.281458   0.008214  -34.267
## icu_admit_source2Other                -0.195166   0.032709   -5.967
## icu_admit_source2Step-Down Unit        0.012350   0.020723    0.596
## hospital_teaching_statusf             -0.327672   0.024226  -13.526
## hospital_teaching_statust             -0.291603   0.024332  -11.984
## hospital_size<100                      0.713440   0.023164   30.800
## hospital_size100-249                   0.406885   0.018854   21.581
## hospital_size250-500                   0.377611   0.019187   19.680
## hospital_size>500                      0.222832   0.017857   12.479
## physicianSpeciality2Speciality-Other  -0.574583   0.007441  -77.215
## hospitaldischargeyear2011              0.072656   0.012825    5.665
## hospitaldischargeyear2012             -0.089982   0.012458   -7.223
## hospitaldischargeyear2013             -0.098500   0.012175   -8.090
## hospitaldischargeyear2014             -0.126439   0.012083  -10.464
## hospitaldischargeyear2015-16          -0.080106   0.011959   -6.699
## dialysis1                              0.244431   0.017266   14.157
## aids1                                  1.316464   0.086323   15.250
## hepaticfailureTRUE                     0.133771   0.021190    6.313
## diabetes1                             -0.057409   0.008208   -6.994
## immunosuppression1                     0.594927   0.019985   29.768
## leukemia1                              0.493029   0.033257   14.825
## lymphoma1                              0.402676   0.045354    8.878
## metastaticcancer1                      0.076569   0.023661    3.236
## thrombolytics1                        -2.190913   0.060142  -36.429
## sofa_respiration_baseline2TRUE         0.460443   0.007332   62.796
## cardiovascular_baseline1              -0.081378   0.008038  -10.125
##                                       Pr(>|z|)    
## (Intercept)                            < 2e-16 ***
## as.factor(qSOFA_Positive)TRUE          < 2e-16 ***
## age_Ranges(25,35]                     7.19e-10 ***
## age_Ranges(35,45]                      < 2e-16 ***
## age_Ranges(45,55]                      < 2e-16 ***
## age_Ranges(55,65]                      < 2e-16 ***
## age_Ranges(65,75]                      < 2e-16 ***
## age_Ranges(75,85]                      < 2e-16 ***
## age_Ranges(85,100]                     < 2e-16 ***
## gender2Female                         1.67e-07 ***
## gender2Other/Unknown                  0.000185 ***
## ethnicity2African American            9.48e-08 ***
## ethnicity2Hispanic                     < 2e-16 ***
## ethnicity2Asian                       0.004227 ** 
## ethnicity2Native American             1.18e-15 ***
## ethnicity2Other/Unknown               2.02e-11 ***
## BMI_Ranges(18.5,25]                    < 2e-16 ***
## BMI_Ranges(25,35]                      < 2e-16 ***
## BMI_Ranges(35,200]                    1.16e-08 ***
## BMI_RangesOther/Unknown                < 2e-16 ***
## icu_admit_source2OR/Proc Area          < 2e-16 ***
## icu_admit_source2Direct Admit          < 2e-16 ***
## icu_admit_source2Emergency Department  < 2e-16 ***
## icu_admit_source2Other                2.42e-09 ***
## icu_admit_source2Step-Down Unit       0.551192    
## hospital_teaching_statusf              < 2e-16 ***
## hospital_teaching_statust              < 2e-16 ***
## hospital_size<100                      < 2e-16 ***
## hospital_size100-249                   < 2e-16 ***
## hospital_size250-500                   < 2e-16 ***
## hospital_size>500                      < 2e-16 ***
## physicianSpeciality2Speciality-Other   < 2e-16 ***
## hospitaldischargeyear2011             1.47e-08 ***
## hospitaldischargeyear2012             5.08e-13 ***
## hospitaldischargeyear2013             5.95e-16 ***
## hospitaldischargeyear2014              < 2e-16 ***
## hospitaldischargeyear2015-16          2.11e-11 ***
## dialysis1                              < 2e-16 ***
## aids1                                  < 2e-16 ***
## hepaticfailureTRUE                    2.74e-10 ***
## diabetes1                             2.67e-12 ***
## immunosuppression1                     < 2e-16 ***
## leukemia1                              < 2e-16 ***
## lymphoma1                              < 2e-16 ***
## metastaticcancer1                     0.001212 ** 
## thrombolytics1                         < 2e-16 ***
## sofa_respiration_baseline2TRUE         < 2e-16 ***
## cardiovascular_baseline1               < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 647128  on 638756  degrees of freedom
## Residual deviance: 577744  on 638709  degrees of freedom
## AIC: 577840
## 
## Number of Fisher Scoring iterations: 6
ssd_incl_te$qSOFA2ADJSepsisPred <- predict(qSOFA2_ADJ_Sepsis_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")
library(sjPlot)
library(ROCR)

qSOFA2ADJSepsis.Pred <- prediction(ssd_incl_te$qSOFA2ADJSepsisPred, ssd_incl_te$sepsis_outcome)
qSOFA2ADJSepsis.Perf <- performance(qSOFA2ADJSepsis.Pred, "tpr", "fpr")
plot(qSOFA2ADJSepsis.Perf, main = "qSOFA Positive Adjusted
     Sepsis Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(qSOFA2ADJSepsis.Pred,"auc")@y.values[[1]],3))) 

performance(qSOFA2ADJSepsis.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.7291955
## 
## 
## Slot "alpha.values":
## list()
qSOFA2ADJSepsis.Pred.roc <- roc(sepsis_outcome~qSOFA2ADJSepsisPred,data=ssd_incl_te)
ci(qSOFA2ADJSepsis.Pred.roc, conf.level=0.99)
## 99% CI: 0.7263-0.7321 (DeLong)
ggplot(calibration(as.factor(!sepsis_outcome)~qSOFA2ADJSepsisPred, data = ssd_incl_te))+ggtitle("Calibration of qSOFA Positive Sepsis Prediction")
## Warning: Removed 1 rows containing missing values (geom_errorbar).

qplot(qSOFA2ADJSepsisPred, data = ssd_incl_te)+ggtitle("Histogram of qSOFA Positive Sepsis Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

SOFA1_ADJ_Sepsis_tr<-glm(sepsis_outcome ~ as.factor(SOFA_Change) + age_Ranges + gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + hospital_teaching_status + hospital_size + physicianSpeciality2 + hospitaldischargeyear + dialysis + aids + hepaticfailure  + diabetes + immunosuppression + leukemia + lymphoma + metastaticcancer + thrombolytics + sofa_respiration_baseline2 + cardiovascular_baseline, data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(SOFA1_ADJ_Sepsis_tr)
#sjt.glm(SOFA1_ADJ_Sepsis_tr)

#drop1(SOFA1_ADJ_Sepsis_tr,test="Chisq")

summary(SOFA1_ADJ_Sepsis_tr)
## 
## Call:
## glm(formula = sepsis_outcome ~ as.factor(SOFA_Change) + age_Ranges + 
##     gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + hospital_teaching_status + 
##     hospital_size + physicianSpeciality2 + hospitaldischargeyear + 
##     dialysis + aids + hepaticfailure + diabetes + immunosuppression + 
##     leukemia + lymphoma + metastaticcancer + thrombolytics + 
##     sofa_respiration_baseline2 + cardiovascular_baseline, family = "binomial", 
##     data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.1484  -0.6904  -0.4485  -0.1961   3.6099  
## 
## Coefficients:
##                                         Estimate Std. Error  z value
## (Intercept)                           -2.2974474  0.0374927  -61.277
## as.factor(SOFA_Change) 1               0.3815506  0.0195444   19.522
## as.factor(SOFA_Change) 2               0.7749043  0.0198496   39.039
## as.factor(SOFA_Change) 3               1.1701393  0.0196310   59.607
## as.factor(SOFA_Change) 4               1.3627618  0.0197353   69.052
## as.factor(SOFA_Change) 5               1.5448495  0.0201691   76.595
## as.factor(SOFA_Change) 6               1.8229743  0.0209532   87.002
## as.factor(SOFA_Change) 7               1.9324285  0.0217400   88.888
## as.factor(SOFA_Change) 8               2.0646047  0.0233577   88.391
## as.factor(SOFA_Change) 9               2.2093509  0.0254045   86.967
## as.factor(SOFA_Change)10               2.3112344  0.0280222   82.479
## as.factor(SOFA_Change)11               2.3462752  0.0312230   75.146
## as.factor(SOFA_Change)12               2.4894621  0.0362115   68.748
## as.factor(SOFA_Change)13               2.6173961  0.0422963   61.882
## as.factor(SOFA_Change)14               2.6895330  0.0511733   52.557
## as.factor(SOFA_Change)15               2.8433938  0.0621335   45.763
## as.factor(SOFA_Change)16               2.9439344  0.0789525   37.287
## as.factor(SOFA_Change)17               2.9272520  0.1085591   26.965
## as.factor(SOFA_Change)[18,23]          3.3159140  0.1113884   29.769
## age_Ranges(25,35]                      0.1229100  0.0276502    4.445
## age_Ranges(35,45]                      0.2329097  0.0257154    9.057
## age_Ranges(45,55]                      0.3447512  0.0237784   14.499
## age_Ranges(55,65]                      0.4805564  0.0232537   20.666
## age_Ranges(65,75]                      0.4982811  0.0232423   21.439
## age_Ranges(75,85]                      0.5414234  0.0233603   23.177
## age_Ranges(85,100]                     0.6497776  0.0245559   26.461
## gender2Female                          0.1271904  0.0068417   18.591
## gender2Other/Unknown                  -1.0727793  0.2680879   -4.002
## ethnicity2African American            -0.1476021  0.0110779  -13.324
## ethnicity2Hispanic                     0.3656723  0.0152937   23.910
## ethnicity2Asian                        0.0024908  0.0298339    0.083
## ethnicity2Native American              0.1088718  0.0380294    2.863
## ethnicity2Other/Unknown                0.0042039  0.0149839    0.281
## BMI_Ranges(18.5,25]                   -0.2257829  0.0151932  -14.861
## BMI_Ranges(25,35]                     -0.3092834  0.0148901  -20.771
## BMI_Ranges(35,200]                    -0.1599401  0.0161740   -9.889
## BMI_RangesOther/Unknown               -0.5402381  0.0237741  -22.724
## icu_admit_source2OR/Proc Area         -1.9657000  0.0146192 -134.460
## icu_admit_source2Direct Admit         -0.5749002  0.0129442  -44.414
## icu_admit_source2Emergency Department -0.2114964  0.0084562  -25.011
## icu_admit_source2Other                -0.2096404  0.0336959   -6.222
## icu_admit_source2Step-Down Unit       -0.0002818  0.0213110   -0.013
## hospital_teaching_statusf             -0.1461240  0.0249314   -5.861
## hospital_teaching_statust             -0.1006492  0.0251522   -4.002
## hospital_size<100                      0.7137552  0.0237263   30.083
## hospital_size100-249                   0.3137806  0.0193616   16.206
## hospital_size250-500                   0.2302913  0.0197074   11.686
## hospital_size>500                      0.0771523  0.0184306    4.186
## physicianSpeciality2Speciality-Other  -0.4624119  0.0076889  -60.140
## hospitaldischargeyear2011              0.0978542  0.0131609    7.435
## hospitaldischargeyear2012             -0.0269191  0.0127768   -2.107
## hospitaldischargeyear2013             -0.0013943  0.0124847   -0.112
## hospitaldischargeyear2014             -0.0355241  0.0123910   -2.867
## hospitaldischargeyear2015-16          -0.0187272  0.0122673   -1.527
## dialysis1                              0.4040387  0.0177082   22.816
## aids1                                  1.2901577  0.0892030   14.463
## hepaticfailureTRUE                    -0.1266740  0.0216698   -5.846
## diabetes1                             -0.0546649  0.0084230   -6.490
## immunosuppression1                     0.5625198  0.0206016   27.305
## leukemia1                              0.2855345  0.0343888    8.303
## lymphoma1                              0.3310231  0.0469236    7.055
## metastaticcancer1                      0.0610930  0.0244262    2.501
## thrombolytics1                        -2.1415436  0.0608640  -35.186
## sofa_respiration_baseline2TRUE         0.6184497  0.0075956   81.422
## cardiovascular_baseline1              -0.1408438  0.0082414  -17.090
##                                       Pr(>|z|)    
## (Intercept)                            < 2e-16 ***
## as.factor(SOFA_Change) 1               < 2e-16 ***
## as.factor(SOFA_Change) 2               < 2e-16 ***
## as.factor(SOFA_Change) 3               < 2e-16 ***
## as.factor(SOFA_Change) 4               < 2e-16 ***
## as.factor(SOFA_Change) 5               < 2e-16 ***
## as.factor(SOFA_Change) 6               < 2e-16 ***
## as.factor(SOFA_Change) 7               < 2e-16 ***
## as.factor(SOFA_Change) 8               < 2e-16 ***
## as.factor(SOFA_Change) 9               < 2e-16 ***
## as.factor(SOFA_Change)10               < 2e-16 ***
## as.factor(SOFA_Change)11               < 2e-16 ***
## as.factor(SOFA_Change)12               < 2e-16 ***
## as.factor(SOFA_Change)13               < 2e-16 ***
## as.factor(SOFA_Change)14               < 2e-16 ***
## as.factor(SOFA_Change)15               < 2e-16 ***
## as.factor(SOFA_Change)16               < 2e-16 ***
## as.factor(SOFA_Change)17               < 2e-16 ***
## as.factor(SOFA_Change)[18,23]          < 2e-16 ***
## age_Ranges(25,35]                     8.78e-06 ***
## age_Ranges(35,45]                      < 2e-16 ***
## age_Ranges(45,55]                      < 2e-16 ***
## age_Ranges(55,65]                      < 2e-16 ***
## age_Ranges(65,75]                      < 2e-16 ***
## age_Ranges(75,85]                      < 2e-16 ***
## age_Ranges(85,100]                     < 2e-16 ***
## gender2Female                          < 2e-16 ***
## gender2Other/Unknown                  6.29e-05 ***
## ethnicity2African American             < 2e-16 ***
## ethnicity2Hispanic                     < 2e-16 ***
## ethnicity2Asian                        0.93346    
## ethnicity2Native American              0.00420 ** 
## ethnicity2Other/Unknown                0.77905    
## BMI_Ranges(18.5,25]                    < 2e-16 ***
## BMI_Ranges(25,35]                      < 2e-16 ***
## BMI_Ranges(35,200]                     < 2e-16 ***
## BMI_RangesOther/Unknown                < 2e-16 ***
## icu_admit_source2OR/Proc Area          < 2e-16 ***
## icu_admit_source2Direct Admit          < 2e-16 ***
## icu_admit_source2Emergency Department  < 2e-16 ***
## icu_admit_source2Other                4.92e-10 ***
## icu_admit_source2Step-Down Unit        0.98945    
## hospital_teaching_statusf             4.60e-09 ***
## hospital_teaching_statust             6.29e-05 ***
## hospital_size<100                      < 2e-16 ***
## hospital_size100-249                   < 2e-16 ***
## hospital_size250-500                   < 2e-16 ***
## hospital_size>500                     2.84e-05 ***
## physicianSpeciality2Speciality-Other   < 2e-16 ***
## hospitaldischargeyear2011             1.04e-13 ***
## hospitaldischargeyear2012              0.03513 *  
## hospitaldischargeyear2013              0.91108    
## hospitaldischargeyear2014              0.00414 ** 
## hospitaldischargeyear2015-16           0.12686    
## dialysis1                              < 2e-16 ***
## aids1                                  < 2e-16 ***
## hepaticfailureTRUE                    5.05e-09 ***
## diabetes1                             8.59e-11 ***
## immunosuppression1                     < 2e-16 ***
## leukemia1                              < 2e-16 ***
## lymphoma1                             1.73e-12 ***
## metastaticcancer1                      0.01238 *  
## thrombolytics1                         < 2e-16 ***
## sofa_respiration_baseline2TRUE         < 2e-16 ***
## cardiovascular_baseline1               < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 647128  on 638756  degrees of freedom
## Residual deviance: 551351  on 638692  degrees of freedom
## AIC: 551481
## 
## Number of Fisher Scoring iterations: 6
ssd_incl_te$SOFA1ADJSepsisPred <- predict(SOFA1_ADJ_Sepsis_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")
library(sjPlot)
library(ROCR)

SOFA1ADJSepsis.Pred <- prediction(ssd_incl_te$SOFA1ADJSepsisPred, ssd_incl_te$sepsis_outcome)
SOFA1ADJSepsis.Perf <- performance(SOFA1ADJSepsis.Pred, "tpr", "fpr")
plot(SOFA1ADJSepsis.Perf, main = "SOFA Continuous Adjusted
     Sepsis Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(SOFA1ADJSepsis.Pred,"auc")@y.values[[1]],3))) 

performance(SOFA1ADJSepsis.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.7678386
## 
## 
## Slot "alpha.values":
## list()
SOFA1ADJSepsis.Pred.roc <- roc(sepsis_outcome~SOFA1ADJSepsisPred,data=ssd_incl_te)
ci(SOFA1ADJSepsis.Pred.roc, conf.level=0.99)
## 99% CI: 0.7651-0.7706 (DeLong)
ggplot(calibration(as.factor(!sepsis_outcome)~SOFA1ADJSepsisPred, data = ssd_incl_te))+ggtitle("Calibration of SOFA Total Sepsis Prediction")

qplot(SOFA1ADJSepsisPred, data = ssd_incl_te)+ggtitle("Histogram of SOFA Total Sepsis Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

SOFA2_ADJ_Sepsis_tr<-glm(sepsis_outcome ~ as.factor(SOFA_Positive) + age_Ranges + gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + hospital_teaching_status + hospital_size + physicianSpeciality2 + hospitaldischargeyear + dialysis + aids + hepaticfailure  + diabetes + immunosuppression + leukemia + lymphoma + metastaticcancer + thrombolytics + sofa_respiration_baseline2 + cardiovascular_baseline, data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(SOFA2_ADJ_Sepsis_tr)
#sjt.glm(SOFA2_ADJ_Sepsis_tr)

#drop1(SOFA2_ADJ_Sepsis_tr,test="Chisq")

summary(SOFA2_ADJ_Sepsis_tr)
## 
## Call:
## glm(formula = sepsis_outcome ~ as.factor(SOFA_Positive) + age_Ranges + 
##     gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + hospital_teaching_status + 
##     hospital_size + physicianSpeciality2 + hospitaldischargeyear + 
##     dialysis + aids + hepaticfailure + diabetes + immunosuppression + 
##     leukemia + lymphoma + metastaticcancer + thrombolytics + 
##     sofa_respiration_baseline2 + cardiovascular_baseline, family = "binomial", 
##     data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.0192  -0.7443  -0.4524  -0.2092   3.5876  
## 
## Coefficients:
##                                        Estimate Std. Error  z value
## (Intercept)                           -1.866539   0.033429  -55.836
## as.factor(SOFA_Positive)TRUE           1.164883   0.008868  131.351
## age_Ranges(25,35]                      0.137449   0.027266    5.041
## age_Ranges(35,45]                      0.274264   0.025343   10.822
## age_Ranges(45,55]                      0.412183   0.023445   17.581
## age_Ranges(55,65]                      0.565255   0.022934   24.647
## age_Ranges(65,75]                      0.581553   0.022928   25.364
## age_Ranges(75,85]                      0.616061   0.023045   26.733
## age_Ranges(85,100]                     0.705917   0.024213   29.154
## gender2Female                          0.095499   0.006697   14.261
## gender2Other/Unknown                  -0.942238   0.264427   -3.563
## ethnicity2African American            -0.110263   0.010823  -10.188
## ethnicity2Hispanic                     0.396282   0.014972   26.468
## ethnicity2Asian                        0.046724   0.029111    1.605
## ethnicity2Native American              0.237499   0.037012    6.417
## ethnicity2Other/Unknown                0.054637   0.014656    3.728
## BMI_Ranges(18.5,25]                   -0.244758   0.014907  -16.419
## BMI_Ranges(25,35]                     -0.318271   0.014606  -21.790
## BMI_Ranges(35,200]                    -0.137382   0.015857   -8.664
## BMI_RangesOther/Unknown               -0.558014   0.023324  -23.924
## icu_admit_source2OR/Proc Area         -1.953553   0.014426 -135.421
## icu_admit_source2Direct Admit         -0.571572   0.012627  -45.267
## icu_admit_source2Emergency Department -0.267005   0.008265  -32.306
## icu_admit_source2Other                -0.192005   0.032909   -5.834
## icu_admit_source2Step-Down Unit        0.008125   0.020835    0.390
## hospital_teaching_statusf             -0.204197   0.024402   -8.368
## hospital_teaching_statust             -0.169205   0.024587   -6.882
## hospital_size<100                      0.628172   0.023346   26.907
## hospital_size100-249                   0.304835   0.018999   16.045
## hospital_size250-500                   0.257730   0.019331   13.333
## hospital_size>500                      0.111995   0.018061    6.201
## physicianSpeciality2Speciality-Other  -0.550969   0.007502  -73.439
## hospitaldischargeyear2011              0.097619   0.012887    7.575
## hospitaldischargeyear2012             -0.034698   0.012515   -2.773
## hospitaldischargeyear2013             -0.021472   0.012235   -1.755
## hospitaldischargeyear2014             -0.054462   0.012142   -4.486
## hospitaldischargeyear2015-16          -0.015746   0.012015   -1.310
## dialysis1                              0.315902   0.017433   18.121
## aids1                                  1.312983   0.086851   15.118
## hepaticfailureTRUE                     0.003690   0.021156    0.174
## diabetes1                             -0.088014   0.008260  -10.655
## immunosuppression1                     0.573149   0.020116   28.492
## leukemia1                              0.407810   0.033338   12.233
## lymphoma1                              0.379349   0.045566    8.325
## metastaticcancer1                      0.074469   0.023833    3.125
## thrombolytics1                        -2.080211   0.060319  -34.487
## sofa_respiration_baseline2TRUE         0.516772   0.007399   69.843
## cardiovascular_baseline1              -0.117735   0.008087  -14.559
##                                       Pr(>|z|)    
## (Intercept)                            < 2e-16 ***
## as.factor(SOFA_Positive)TRUE           < 2e-16 ***
## age_Ranges(25,35]                     4.63e-07 ***
## age_Ranges(35,45]                      < 2e-16 ***
## age_Ranges(45,55]                      < 2e-16 ***
## age_Ranges(55,65]                      < 2e-16 ***
## age_Ranges(65,75]                      < 2e-16 ***
## age_Ranges(75,85]                      < 2e-16 ***
## age_Ranges(85,100]                     < 2e-16 ***
## gender2Female                          < 2e-16 ***
## gender2Other/Unknown                  0.000366 ***
## ethnicity2African American             < 2e-16 ***
## ethnicity2Hispanic                     < 2e-16 ***
## ethnicity2Asian                       0.108479    
## ethnicity2Native American             1.39e-10 ***
## ethnicity2Other/Unknown               0.000193 ***
## BMI_Ranges(18.5,25]                    < 2e-16 ***
## BMI_Ranges(25,35]                      < 2e-16 ***
## BMI_Ranges(35,200]                     < 2e-16 ***
## BMI_RangesOther/Unknown                < 2e-16 ***
## icu_admit_source2OR/Proc Area          < 2e-16 ***
## icu_admit_source2Direct Admit          < 2e-16 ***
## icu_admit_source2Emergency Department  < 2e-16 ***
## icu_admit_source2Other                5.40e-09 ***
## icu_admit_source2Step-Down Unit       0.696569    
## hospital_teaching_statusf              < 2e-16 ***
## hospital_teaching_statust             5.91e-12 ***
## hospital_size<100                      < 2e-16 ***
## hospital_size100-249                   < 2e-16 ***
## hospital_size250-500                   < 2e-16 ***
## hospital_size>500                     5.61e-10 ***
## physicianSpeciality2Speciality-Other   < 2e-16 ***
## hospitaldischargeyear2011             3.60e-14 ***
## hospitaldischargeyear2012             0.005562 ** 
## hospitaldischargeyear2013             0.079263 .  
## hospitaldischargeyear2014             7.27e-06 ***
## hospitaldischargeyear2015-16          0.190031    
## dialysis1                              < 2e-16 ***
## aids1                                  < 2e-16 ***
## hepaticfailureTRUE                    0.861542    
## diabetes1                              < 2e-16 ***
## immunosuppression1                     < 2e-16 ***
## leukemia1                              < 2e-16 ***
## lymphoma1                              < 2e-16 ***
## metastaticcancer1                     0.001781 ** 
## thrombolytics1                         < 2e-16 ***
## sofa_respiration_baseline2TRUE         < 2e-16 ***
## cardiovascular_baseline1               < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 647128  on 638756  degrees of freedom
## Residual deviance: 569984  on 638709  degrees of freedom
## AIC: 570080
## 
## Number of Fisher Scoring iterations: 6
ssd_incl_te$SOFA2ADJSepsisPred <- predict(SOFA2_ADJ_Sepsis_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")
library(sjPlot)
library(ROCR)

SOFA2ADJSepsis.Pred <- prediction(ssd_incl_te$SOFA2ADJSepsisPred, ssd_incl_te$sepsis_outcome)
SOFA2ADJSepsis.Perf <- performance(SOFA2ADJSepsis.Pred, "tpr", "fpr")
plot(SOFA2ADJSepsis.Perf, main = "SOFA Positive Adjusted Sepsis Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(SOFA2ADJSepsis.Pred,"auc")@y.values[[1]],3))) 

performance(SOFA2ADJSepsis.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.7398636
## 
## 
## Slot "alpha.values":
## list()
SOFA2ADJSepsis.Pred.roc <- roc(sepsis_outcome~SOFA2ADJSepsisPred,data=ssd_incl_te)
ci(SOFA2ADJSepsis.Pred.roc, conf.level=0.99)
## 99% CI: 0.7371-0.7427 (DeLong)
ggplot(calibration(as.factor(!sepsis_outcome)~SOFA2ADJSepsisPred, data = ssd_incl_te))+ggtitle("Calibration of SOFA Positive Sepsis Prediction")
## Warning: Removed 1 rows containing missing values (geom_errorbar).

qplot(SOFA2ADJSepsisPred, data = ssd_incl_te)+ggtitle("Histogram of SOFA Positive Sepsis Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

SOFA Score w/o Baseline SOFA

SOFA3_ADJ_Sepsis_tr<-glm(sepsis_outcome ~ as.factor(SOFA_Positive2) + age_Ranges + gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + hospital_teaching_status + hospital_size + physicianSpeciality2 + hospitaldischargeyear + dialysis + aids + hepaticfailure  + diabetes + immunosuppression + leukemia + lymphoma + metastaticcancer + thrombolytics + sofa_respiration_baseline2 + cardiovascular_baseline, data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(SOFA3_ADJ_Sepsis_tr)
#sjt.glm(SOFA3_ADJ_Sepsis_tr)

#drop1(SOFA3_ADJ_Sepsis_tr,test="Chisq")

summary(SOFA3_ADJ_Sepsis_tr)
## 
## Call:
## glm(formula = sepsis_outcome ~ as.factor(SOFA_Positive2) + age_Ranges + 
##     gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + hospital_teaching_status + 
##     hospital_size + physicianSpeciality2 + hospitaldischargeyear + 
##     dialysis + aids + hepaticfailure + diabetes + immunosuppression + 
##     leukemia + lymphoma + metastaticcancer + thrombolytics + 
##     sofa_respiration_baseline2 + cardiovascular_baseline, family = "binomial", 
##     data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.0136  -0.7503  -0.4458  -0.2054   3.5975  
## 
## Coefficients:
##                                        Estimate Std. Error  z value
## (Intercept)                           -1.914544   0.033544  -57.076
## as.factor(SOFA_Positive2)TRUE          1.224253   0.009377  130.565
## age_Ranges(25,35]                      0.130401   0.027284    4.779
## age_Ranges(35,45]                      0.266394   0.025362   10.504
## age_Ranges(45,55]                      0.406306   0.023462   17.317
## age_Ranges(55,65]                      0.560699   0.022951   24.430
## age_Ranges(65,75]                      0.579444   0.022944   25.254
## age_Ranges(75,85]                      0.615448   0.023060   26.689
## age_Ranges(85,100]                     0.705471   0.024228   29.118
## gender2Female                          0.093724   0.006695   14.000
## gender2Other/Unknown                  -0.960428   0.264839   -3.626
## ethnicity2African American            -0.114321   0.010813  -10.572
## ethnicity2Hispanic                     0.387527   0.014970   25.887
## ethnicity2Asian                        0.045671   0.029083    1.570
## ethnicity2Native American              0.243562   0.036956    6.591
## ethnicity2Other/Unknown                0.052189   0.014652    3.562
## BMI_Ranges(18.5,25]                   -0.245088   0.014904  -16.445
## BMI_Ranges(25,35]                     -0.317553   0.014603  -21.745
## BMI_Ranges(35,200]                    -0.140167   0.015853   -8.841
## BMI_RangesOther/Unknown               -0.557646   0.023327  -23.906
## icu_admit_source2OR/Proc Area         -1.950075   0.014424 -135.194
## icu_admit_source2Direct Admit         -0.569207   0.012622  -45.098
## icu_admit_source2Emergency Department -0.265782   0.008261  -32.173
## icu_admit_source2Other                -0.183132   0.032888   -5.568
## icu_admit_source2Step-Down Unit        0.011418   0.020819    0.548
## hospital_teaching_statusf             -0.203830   0.024390   -8.357
## hospital_teaching_statust             -0.168029   0.024579   -6.836
## hospital_size<100                      0.626015   0.023351   26.809
## hospital_size100-249                   0.301889   0.018988   15.899
## hospital_size250-500                   0.259083   0.019320   13.410
## hospital_size>500                      0.110670   0.018054    6.130
## physicianSpeciality2Speciality-Other  -0.546170   0.007503  -72.790
## hospitaldischargeyear2011              0.097124   0.012885    7.538
## hospitaldischargeyear2012             -0.034913   0.012512   -2.790
## hospitaldischargeyear2013             -0.024620   0.012231   -2.013
## hospitaldischargeyear2014             -0.056569   0.012138   -4.661
## hospitaldischargeyear2015-16          -0.018383   0.012011   -1.530
## dialysis1                              0.028401   0.017084    1.662
## aids1                                  1.325191   0.086796   15.268
## hepaticfailureTRUE                    -0.003968   0.021092   -0.188
## diabetes1                             -0.086506   0.008253  -10.482
## immunosuppression1                     0.568214   0.020114   28.250
## leukemia1                              0.414446   0.033304   12.444
## lymphoma1                              0.383929   0.045572    8.425
## metastaticcancer1                      0.076147   0.023836    3.195
## thrombolytics1                        -2.069251   0.060320  -34.305
## sofa_respiration_baseline2TRUE         0.482563   0.007387   65.326
## cardiovascular_baseline1              -0.118644   0.008078  -14.688
##                                       Pr(>|z|)    
## (Intercept)                            < 2e-16 ***
## as.factor(SOFA_Positive2)TRUE          < 2e-16 ***
## age_Ranges(25,35]                     1.76e-06 ***
## age_Ranges(35,45]                      < 2e-16 ***
## age_Ranges(45,55]                      < 2e-16 ***
## age_Ranges(55,65]                      < 2e-16 ***
## age_Ranges(65,75]                      < 2e-16 ***
## age_Ranges(75,85]                      < 2e-16 ***
## age_Ranges(85,100]                     < 2e-16 ***
## gender2Female                          < 2e-16 ***
## gender2Other/Unknown                  0.000287 ***
## ethnicity2African American             < 2e-16 ***
## ethnicity2Hispanic                     < 2e-16 ***
## ethnicity2Asian                       0.116327    
## ethnicity2Native American             4.38e-11 ***
## ethnicity2Other/Unknown               0.000368 ***
## BMI_Ranges(18.5,25]                    < 2e-16 ***
## BMI_Ranges(25,35]                      < 2e-16 ***
## BMI_Ranges(35,200]                     < 2e-16 ***
## BMI_RangesOther/Unknown                < 2e-16 ***
## icu_admit_source2OR/Proc Area          < 2e-16 ***
## icu_admit_source2Direct Admit          < 2e-16 ***
## icu_admit_source2Emergency Department  < 2e-16 ***
## icu_admit_source2Other                2.57e-08 ***
## icu_admit_source2Step-Down Unit       0.583380    
## hospital_teaching_statusf              < 2e-16 ***
## hospital_teaching_statust             8.13e-12 ***
## hospital_size<100                      < 2e-16 ***
## hospital_size100-249                   < 2e-16 ***
## hospital_size250-500                   < 2e-16 ***
## hospital_size>500                     8.78e-10 ***
## physicianSpeciality2Speciality-Other   < 2e-16 ***
## hospitaldischargeyear2011             4.78e-14 ***
## hospitaldischargeyear2012             0.005264 ** 
## hospitaldischargeyear2013             0.044123 *  
## hospitaldischargeyear2014             3.15e-06 ***
## hospitaldischargeyear2015-16          0.125897    
## dialysis1                             0.096429 .  
## aids1                                  < 2e-16 ***
## hepaticfailureTRUE                    0.850790    
## diabetes1                              < 2e-16 ***
## immunosuppression1                     < 2e-16 ***
## leukemia1                              < 2e-16 ***
## lymphoma1                              < 2e-16 ***
## metastaticcancer1                     0.001400 ** 
## thrombolytics1                         < 2e-16 ***
## sofa_respiration_baseline2TRUE         < 2e-16 ***
## cardiovascular_baseline1               < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 647128  on 638756  degrees of freedom
## Residual deviance: 569775  on 638709  degrees of freedom
## AIC: 569871
## 
## Number of Fisher Scoring iterations: 6
ssd_incl_te$SOFA3ADJSepsisPred <- predict(SOFA3_ADJ_Sepsis_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")
library(sjPlot)
library(ROCR)

SOFA3ADJSepsis.Pred <- prediction(ssd_incl_te$SOFA3ADJSepsisPred, ssd_incl_te$sepsis_outcome)
SOFA3ADJSepsis.Perf <- performance(SOFA3ADJSepsis.Pred, "tpr", "fpr")
plot(SOFA3ADJSepsis.Perf, main = "SOFA Positive w/o Baseline  Adjusted 
     Sepsis Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(SOFA3ADJSepsis.Pred,"auc")@y.values[[1]],3))) 

performance(SOFA3ADJSepsis.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.7393518
## 
## 
## Slot "alpha.values":
## list()
SOFA3ADJSepsis.Pred.roc <- roc(sepsis_outcome~SOFA3ADJSepsisPred,data=ssd_incl_te)
ci(SOFA3ADJSepsis.Pred.roc, conf.level=0.99)
## 99% CI: 0.7366-0.7421 (DeLong)
ggplot(calibration(as.factor(!sepsis_outcome)~SOFA3ADJSepsisPred, data = ssd_incl_te))+ggtitle("Calibration of SOFA Positive w/o Baseline Sepsis Prediction")
## Warning: Removed 1 rows containing missing values (geom_errorbar).

qplot(SOFA3ADJSepsisPred, data = ssd_incl_te)+ggtitle("Histogram of SOFA Positive w/o Baseline Sepsis Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

FuzzyLogic_ADJ_Sepsis_tr<-glm(sepsis_outcome ~ (SepsisFuzzyLogicPositive) + age_Ranges + gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + hospital_teaching_status + hospital_size + physicianSpeciality2 + hospitaldischargeyear + dialysis + aids + hepaticfailure  + diabetes + immunosuppression + leukemia + lymphoma + metastaticcancer + thrombolytics + sofa_respiration_baseline2 + cardiovascular_baseline, data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(FuzzyLogic_ADJ_Sepsis_tr)
#sjt.glm(FuzzyLogic_ADJ_Sepsis_tr)

#drop1(FuzzyLogic_ADJ_Sepsis_tr,test="Chisq")

summary(FuzzyLogic_ADJ_Sepsis_tr)
## 
## Call:
## glm(formula = sepsis_outcome ~ (SepsisFuzzyLogicPositive) + age_Ranges + 
##     gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + hospital_teaching_status + 
##     hospital_size + physicianSpeciality2 + hospitaldischargeyear + 
##     dialysis + aids + hepaticfailure + diabetes + immunosuppression + 
##     leukemia + lymphoma + metastaticcancer + thrombolytics + 
##     sofa_respiration_baseline2 + cardiovascular_baseline, family = "binomial", 
##     data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.0787  -0.7206  -0.4234  -0.1814   3.6169  
## 
## Coefficients:
##                                        Estimate Std. Error  z value
## (Intercept)                           -2.124152   0.033816  -62.815
## SepsisFuzzyLogicPositiveTRUE           1.494644   0.007929  188.497
## age_Ranges(25,35]                      0.200047   0.027507    7.272
## age_Ranges(35,45]                      0.380838   0.025582   14.887
## age_Ranges(45,55]                      0.539099   0.023648   22.797
## age_Ranges(55,65]                      0.710904   0.023120   30.748
## age_Ranges(65,75]                      0.744332   0.023110   32.209
## age_Ranges(75,85]                      0.822203   0.023233   35.390
## age_Ranges(85,100]                     0.957012   0.024461   39.125
## gender2Female                          0.036346   0.006828    5.323
## gender2Other/Unknown                  -1.078963   0.267177   -4.038
## ethnicity2African American            -0.029079   0.011073   -2.626
## ethnicity2Hispanic                     0.399012   0.015308   26.065
## ethnicity2Asian                        0.110971   0.029812    3.722
## ethnicity2Native American              0.266320   0.037867    7.033
## ethnicity2Other/Unknown                0.046935   0.014927    3.144
## BMI_Ranges(18.5,25]                   -0.220140   0.015229  -14.455
## BMI_Ranges(25,35]                     -0.286701   0.014915  -19.222
## BMI_Ranges(35,200]                    -0.114540   0.016172   -7.083
## BMI_RangesOther/Unknown               -0.465796   0.023828  -19.548
## icu_admit_source2OR/Proc Area         -1.996615   0.014573 -137.012
## icu_admit_source2Direct Admit         -0.459874   0.012939  -35.543
## icu_admit_source2Emergency Department -0.280337   0.008454  -33.161
## icu_admit_source2Other                -0.107824   0.033765   -3.193
## icu_admit_source2Step-Down Unit        0.055622   0.021391    2.600
## hospital_teaching_statusf             -0.240214   0.024886   -9.652
## hospital_teaching_statust             -0.207117   0.025137   -8.240
## hospital_size<100                      0.621431   0.023826   26.082
## hospital_size100-249                   0.311101   0.019367   16.063
## hospital_size250-500                   0.262875   0.019696   13.346
## hospital_size>500                      0.108788   0.018436    5.901
## physicianSpeciality2Speciality-Other  -0.501852   0.007684  -65.313
## hospitaldischargeyear2011              0.092410   0.013172    7.016
## hospitaldischargeyear2012             -0.039503   0.012781   -3.091
## hospitaldischargeyear2013             -0.038688   0.012491   -3.097
## hospitaldischargeyear2014             -0.059266   0.012397   -4.781
## hospitaldischargeyear2015-16          -0.019868   0.012269   -1.619
## dialysis1                              0.270859   0.017788   15.227
## aids1                                  1.331422   0.089546   14.869
## hepaticfailureTRUE                    -0.029653   0.021485   -1.380
## diabetes1                              0.044792   0.008428    5.315
## immunosuppression1                     0.526333   0.020537   25.628
## leukemia1                              0.399091   0.034129   11.694
## lymphoma1                              0.345324   0.046675    7.399
## metastaticcancer1                      0.019801   0.024233    0.817
## thrombolytics1                        -2.110673   0.060512  -34.880
## sofa_respiration_baseline2TRUE         0.392935   0.007544   52.086
## cardiovascular_baseline1              -0.072916   0.008255   -8.833
##                                       Pr(>|z|)    
## (Intercept)                            < 2e-16 ***
## SepsisFuzzyLogicPositiveTRUE           < 2e-16 ***
## age_Ranges(25,35]                     3.53e-13 ***
## age_Ranges(35,45]                      < 2e-16 ***
## age_Ranges(45,55]                      < 2e-16 ***
## age_Ranges(55,65]                      < 2e-16 ***
## age_Ranges(65,75]                      < 2e-16 ***
## age_Ranges(75,85]                      < 2e-16 ***
## age_Ranges(85,100]                     < 2e-16 ***
## gender2Female                         1.02e-07 ***
## gender2Other/Unknown                  5.38e-05 ***
## ethnicity2African American            0.008635 ** 
## ethnicity2Hispanic                     < 2e-16 ***
## ethnicity2Asian                       0.000197 ***
## ethnicity2Native American             2.02e-12 ***
## ethnicity2Other/Unknown               0.001665 ** 
## BMI_Ranges(18.5,25]                    < 2e-16 ***
## BMI_Ranges(25,35]                      < 2e-16 ***
## BMI_Ranges(35,200]                    1.41e-12 ***
## BMI_RangesOther/Unknown                < 2e-16 ***
## icu_admit_source2OR/Proc Area          < 2e-16 ***
## icu_admit_source2Direct Admit          < 2e-16 ***
## icu_admit_source2Emergency Department  < 2e-16 ***
## icu_admit_source2Other                0.001406 ** 
## icu_admit_source2Step-Down Unit       0.009314 ** 
## hospital_teaching_statusf              < 2e-16 ***
## hospital_teaching_statust              < 2e-16 ***
## hospital_size<100                      < 2e-16 ***
## hospital_size100-249                   < 2e-16 ***
## hospital_size250-500                   < 2e-16 ***
## hospital_size>500                     3.61e-09 ***
## physicianSpeciality2Speciality-Other   < 2e-16 ***
## hospitaldischargeyear2011             2.29e-12 ***
## hospitaldischargeyear2012             0.001996 ** 
## hospitaldischargeyear2013             0.001952 ** 
## hospitaldischargeyear2014             1.75e-06 ***
## hospitaldischargeyear2015-16          0.105359    
## dialysis1                              < 2e-16 ***
## aids1                                  < 2e-16 ***
## hepaticfailureTRUE                    0.167532    
## diabetes1                             1.07e-07 ***
## immunosuppression1                     < 2e-16 ***
## leukemia1                              < 2e-16 ***
## lymphoma1                             1.38e-13 ***
## metastaticcancer1                     0.413868    
## thrombolytics1                         < 2e-16 ***
## sofa_respiration_baseline2TRUE         < 2e-16 ***
## cardiovascular_baseline1               < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 647128  on 638756  degrees of freedom
## Residual deviance: 548492  on 638709  degrees of freedom
## AIC: 548588
## 
## Number of Fisher Scoring iterations: 6
ssd_incl_te$FuzzyLogicADJSepsisPred <- predict(FuzzyLogic_ADJ_Sepsis_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")
library(sjPlot)
library(ROCR)

FuzzyLogicADJSepsis.Pred <- prediction(ssd_incl_te$FuzzyLogicADJSepsisPred, ssd_incl_te$sepsis_outcome)
FuzzyLogicADJSepsis.Perf <- performance(FuzzyLogicADJSepsis.Pred, "tpr", "fpr")
plot(FuzzyLogicADJSepsis.Perf, main = "FuzzyLogic Positive Adjusted Sepsis Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(FuzzyLogicADJSepsis.Pred,"auc")@y.values[[1]],3))) 

performance(FuzzyLogicADJSepsis.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.7706897
## 
## 
## Slot "alpha.values":
## list()
FuzzyLogicADJSepsis.Pred.roc <- roc(sepsis_outcome~FuzzyLogicADJSepsisPred,data=ssd_incl_te)
ci(FuzzyLogicADJSepsis.Pred.roc, conf.level=0.99)
## 99% CI: 0.768-0.7734 (DeLong)
ggplot(calibration(as.factor(!sepsis_outcome)~FuzzyLogicADJSepsisPred, data = ssd_incl_te))+ggtitle("Calibration of FuzzyLogic Positive Sepsis Prediction")
## Warning: Removed 1 rows containing missing values (geom_errorbar).

qplot(FuzzyLogicADJSepsisPred, data = ssd_incl_te)+ggtitle("Histogram of FuzzyLogic Positive Sepsis Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

SIRS1_Crude_Sepsis_tr<-glm(sepsis_outcome ~ (SIRS_total), data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(SIRS1_Crude_Sepsis_tr)
#sjt.glm(SIRS1_Crude_Sepsis_tr)

#drop1(SIRS1_Crude_Sepsis_tr,test="Chisq")

summary(SIRS1_Crude_Sepsis_tr)
## 
## Call:
## glm(formula = sepsis_outcome ~ (SIRS_total), family = "binomial", 
##     data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.9790  -0.7802  -0.6119  -0.3651   2.3415  
## 
## Coefficients:
##              Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -2.674538   0.008932  -299.4   <2e-16 ***
## SIRS_total   0.547049   0.003252   168.2   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 647128  on 638756  degrees of freedom
## Residual deviance: 616197  on 638755  degrees of freedom
## AIC: 616201
## 
## Number of Fisher Scoring iterations: 4
ssd_incl_te$SIRS1CrudeSepsisPred <- predict(SIRS1_Crude_Sepsis_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")
library(sjPlot)
library(ROCR)

SIRS1CrudeSepsis.Pred <- prediction(ssd_incl_te$SIRS1CrudeSepsisPred, ssd_incl_te$sepsis_outcome)
SIRS1CrudeSepsis.Perf <- performance(SIRS1CrudeSepsis.Pred, "tpr", "fpr")
plot(SIRS1CrudeSepsis.Perf, main = "SIRS Total Crude Sepsis Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(SIRS1CrudeSepsis.Pred,"auc")@y.values[[1]],3))) 

performance(SIRS1CrudeSepsis.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.6502231
## 
## 
## Slot "alpha.values":
## list()
SIRS1CrudeSepsis.Pred.roc <- roc(sepsis_outcome~SIRS1CrudeSepsisPred,data=ssd_incl_te)
ci(SIRS1CrudeSepsis.Pred.roc, conf.level=0.99)
## 99% CI: 0.6471-0.6534 (DeLong)
ggplot(calibration(as.factor(!sepsis_outcome)~SIRS1CrudeSepsisPred, data = ssd_incl_te))+ggtitle("Calibration of SIRS Total Sepsis Prediction")
## Warning: Removed 7 rows containing missing values (geom_errorbar).

qplot(SIRS1CrudeSepsisPred, data = ssd_incl_te)+ggtitle("Histogram of SIRS Total Sepsis Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

SIRS2_Crude_Sepsis_tr<-glm(sepsis_outcome ~ (SIRS_Positive), data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(SIRS2_Crude_Sepsis_tr)
#sjt.glm(SIRS2_Crude_Sepsis_tr)

#drop1(SIRS2_Crude_Sepsis_tr,test="Chisq")

summary(SIRS2_Crude_Sepsis_tr)
## 
## Call:
## glm(formula = sepsis_outcome ~ (SIRS_Positive), family = "binomial", 
##     data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.7387  -0.7387  -0.7387  -0.4491   2.1653  
## 
## Coefficients:
##                    Estimate Std. Error z value Pr(>|z|)    
## (Intercept)       -2.243447   0.008668  -258.8   <2e-16 ***
## SIRS_PositiveTRUE  1.084204   0.009299   116.6   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 647128  on 638756  degrees of freedom
## Residual deviance: 630537  on 638755  degrees of freedom
## AIC: 630541
## 
## Number of Fisher Scoring iterations: 4
ssd_incl_te$SIRS2CrudeSepsisPred <- predict(SIRS2_Crude_Sepsis_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")
library(sjPlot)
library(ROCR)

SIRS2CrudeSepsis.Pred <- prediction(ssd_incl_te$SIRS2CrudeSepsisPred, ssd_incl_te$sepsis_outcome)
SIRS2CrudeSepsis.Perf <- performance(SIRS2CrudeSepsis.Pred, "tpr", "fpr")
plot(SIRS2CrudeSepsis.Perf, main = "SIRS Positive Crude Sepsis Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(SIRS2CrudeSepsis.Pred,"auc")@y.values[[1]],3))) 

performance(SIRS2CrudeSepsis.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.5805731
## 
## 
## Slot "alpha.values":
## list()
SIRS2CrudeSepsis.Pred.roc <- roc(sepsis_outcome~SIRS2CrudeSepsisPred,data=ssd_incl_te)
ci(SIRS2CrudeSepsis.Pred.roc, conf.level=0.99)
## 99% CI: 0.5785-0.5827 (DeLong)
ggplot(calibration(as.factor(!sepsis_outcome)~SIRS2CrudeSepsisPred, data = ssd_incl_te))+ggtitle("Calibration of SIRS Positive Sepsis Prediction")
## Warning: Removed 9 rows containing missing values (geom_errorbar).

qplot(SIRS2CrudeSepsisPred, data = ssd_incl_te)+ggtitle("Histogram of SIRS Positive Sepsis Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

qSOFA1_Crude_Sepsis_tr<-glm(sepsis_outcome ~ (qSOFA_total), data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(qSOFA1_Crude_Sepsis_tr)
#sjt.glm(qSOFA1_Crude_Sepsis_tr)

#drop1(qSOFA1_Crude_Sepsis_tr,test="Chisq")

summary(qSOFA1_Crude_Sepsis_tr)
## 
## Call:
## glm(formula = sepsis_outcome ~ (qSOFA_total), family = "binomial", 
##     data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.8922  -0.6807  -0.6807  -0.3782   2.3123  
## 
## Coefficients:
##              Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -2.601940   0.009022  -288.4   <2e-16 ***
## qSOFA_total  0.628731   0.004012   156.7   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 647128  on 638756  degrees of freedom
## Residual deviance: 620004  on 638755  degrees of freedom
## AIC: 620008
## 
## Number of Fisher Scoring iterations: 4
ssd_incl_te$qSOFA1CrudeSepsisPred <- predict(qSOFA1_Crude_Sepsis_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")
library(sjPlot)
library(ROCR)

qSOFA1CrudeSepsis.Pred <- prediction(ssd_incl_te$qSOFA1CrudeSepsisPred, ssd_incl_te$sepsis_outcome)
qSOFA1CrudeSepsis.Perf <- performance(qSOFA1CrudeSepsis.Pred, "tpr", "fpr")
plot(qSOFA1CrudeSepsis.Perf, main = "qSOFA1 Total Crude Sepsis Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(qSOFA1CrudeSepsis.Pred,"auc")@y.values[[1]],3))) 

performance(qSOFA1CrudeSepsis.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.6368558
## 
## 
## Slot "alpha.values":
## list()
qSOFA1CrudeSepsis.Pred.roc <- roc(sepsis_outcome~qSOFA1CrudeSepsisPred,data=ssd_incl_te)
ci(qSOFA1CrudeSepsis.Pred.roc, conf.level=0.99)
## 99% CI: 0.6338-0.6399 (DeLong)
ggplot(calibration(as.factor(!sepsis_outcome)~qSOFA1CrudeSepsisPred, data = ssd_incl_te))+ggtitle("Calibration of qSOFA Total Sepsis Prediction")
## Warning: Removed 7 rows containing missing values (geom_errorbar).

qplot(qSOFA1CrudeSepsisPred, data = ssd_incl_te)+ggtitle("Histogram of qSOFA Total Sepsis Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

qSOFA2_Crude_Sepsis_tr<-glm(sepsis_outcome ~ (qSOFA_Positive), data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(qSOFA2_Crude_Sepsis_tr)
#sjt.glm(qSOFA2_Crude_Sepsis_tr)

#drop1(qSOFA2_Crude_Sepsis_tr,test="Chisq")

summary(qSOFA2_Crude_Sepsis_tr)
## 
## Call:
## glm(formula = sepsis_outcome ~ (qSOFA_Positive), family = "binomial", 
##     data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.7565  -0.7565  -0.7565  -0.4915   2.0849  
## 
## Coefficients:
##                     Estimate Std. Error z value Pr(>|z|)    
## (Intercept)        -2.052644   0.006875  -298.6   <2e-16 ***
## qSOFA_PositiveTRUE  0.947849   0.007729   122.6   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 647128  on 638756  degrees of freedom
## Residual deviance: 630027  on 638755  degrees of freedom
## AIC: 630031
## 
## Number of Fisher Scoring iterations: 4
ssd_incl_te$qSOFA2CrudeSepsisPred <- predict(qSOFA2_Crude_Sepsis_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")
library(sjPlot)
library(ROCR)

qSOFA2CrudeSepsis.Pred <- prediction(ssd_incl_te$qSOFA2CrudeSepsisPred, ssd_incl_te$sepsis_outcome)
qSOFA2CrudeSepsis.Perf <- performance(qSOFA2CrudeSepsis.Pred, "tpr", "fpr")
plot(qSOFA2CrudeSepsis.Perf, main = "qSOFA Positive Crude Sepsis Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(qSOFA2CrudeSepsis.Pred,"auc")@y.values[[1]],3))) 

performance(qSOFA2CrudeSepsis.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.5928223
## 
## 
## Slot "alpha.values":
## list()
qSOFA2CrudeSepsis.Pred.roc <- roc(sepsis_outcome~qSOFA2CrudeSepsisPred,data=ssd_incl_te)
ci(qSOFA2CrudeSepsis.Pred.roc, conf.level=0.99)
## 99% CI: 0.5903-0.5953 (DeLong)
ggplot(calibration(as.factor(!sepsis_outcome)~qSOFA2CrudeSepsisPred, data = ssd_incl_te))+ggtitle("Calibration of qSOFA Positive Sepsis Prediction")
## Warning: Removed 9 rows containing missing values (geom_errorbar).

qplot(qSOFA2CrudeSepsisPred, data = ssd_incl_te)+ggtitle("Histogram of qSOFA Positive Sepsis Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

SOFA1_Crude_Sepsis_tr<-glm(sepsis_outcome ~ as.factor(SOFA_Change), data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(SOFA1_Crude_Sepsis_tr)
#sjt.glm(SOFA1_Crude_Sepsis_tr)

#drop1(SOFA1_Crude_Sepsis_tr,test="Chisq")

summary(SOFA1_Crude_Sepsis_tr)
## 
## Call:
## glm(formula = sepsis_outcome ~ as.factor(SOFA_Change), family = "binomial", 
##     data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.4096  -0.7412  -0.5635  -0.3790   2.3105  
## 
## Coefficients:
##                               Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                   -2.59739    0.01702 -152.61   <2e-16 ***
## as.factor(SOFA_Change) 1       0.40363    0.01913   21.10   <2e-16 ***
## as.factor(SOFA_Change) 2       0.83756    0.01933   43.32   <2e-16 ***
## as.factor(SOFA_Change) 3       1.25489    0.01909   65.75   <2e-16 ***
## as.factor(SOFA_Change) 4       1.44584    0.01915   75.50   <2e-16 ***
## as.factor(SOFA_Change) 5       1.59643    0.01951   81.82   <2e-16 ***
## as.factor(SOFA_Change) 6       1.84006    0.02015   91.32   <2e-16 ***
## as.factor(SOFA_Change) 7       1.91239    0.02084   91.78   <2e-16 ***
## as.factor(SOFA_Change) 8       2.01564    0.02226   90.55   <2e-16 ***
## as.factor(SOFA_Change) 9       2.12645    0.02408   88.30   <2e-16 ***
## as.factor(SOFA_Change)10       2.20521    0.02644   83.40   <2e-16 ***
## as.factor(SOFA_Change)11       2.25783    0.02949   76.57   <2e-16 ***
## as.factor(SOFA_Change)12       2.38680    0.03413   69.94   <2e-16 ***
## as.factor(SOFA_Change)13       2.50214    0.03973   62.97   <2e-16 ***
## as.factor(SOFA_Change)14       2.55797    0.04808   53.20   <2e-16 ***
## as.factor(SOFA_Change)15       2.74004    0.05891   46.51   <2e-16 ***
## as.factor(SOFA_Change)16       2.78495    0.07437   37.45   <2e-16 ***
## as.factor(SOFA_Change)17       2.82860    0.10323   27.40   <2e-16 ***
## as.factor(SOFA_Change)[18,23]  3.12842    0.10532   29.70   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 647128  on 638756  degrees of freedom
## Residual deviance: 604543  on 638738  degrees of freedom
## AIC: 604581
## 
## Number of Fisher Scoring iterations: 5
ssd_incl_te$SOFA1CrudeSepsisPred <- predict(SOFA1_Crude_Sepsis_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")
library(sjPlot)
library(ROCR)

SOFA1CrudeSepsis.Pred <- prediction(ssd_incl_te$SOFA1CrudeSepsisPred, ssd_incl_te$sepsis_outcome)
SOFA1CrudeSepsis.Perf <- performance(SOFA1CrudeSepsis.Pred, "tpr", "fpr")
plot(SOFA1CrudeSepsis.Perf, main = "SOFA Continuous Crude Sepsis Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(SOFA1CrudeSepsis.Pred,"auc")@y.values[[1]],3))) 

performance(SOFA1CrudeSepsis.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.6796153
## 
## 
## Slot "alpha.values":
## list()
SOFA1CrudeSepsis.Pred.roc <- roc(sepsis_outcome~SOFA1CrudeSepsisPred,data=ssd_incl_te)
ci(SOFA1CrudeSepsis.Pred.roc, conf.level=0.99)
## 99% CI: 0.6764-0.6828 (DeLong)
ggplot(calibration(as.factor(!sepsis_outcome)~SOFA1CrudeSepsisPred, data = ssd_incl_te))+ggtitle("Calibration of SOFA Total Sepsis Prediction")
## Warning: Removed 4 rows containing missing values (geom_errorbar).

qplot(SOFA1CrudeSepsisPred, data = ssd_incl_te)+ggtitle("Histogram of SOFA Total Sepsis Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

SOFA2_Crude_Sepsis_tr<-glm(sepsis_outcome ~ as.factor(SOFA_Positive), data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(SOFA2_Crude_Sepsis_tr)
#sjt.glm(SOFA2_Crude_Sepsis_tr)

#drop1(SOFA2_Crude_Sepsis_tr,test="Chisq")

summary(SOFA2_Crude_Sepsis_tr)
## 
## Call:
## glm(formula = sepsis_outcome ~ as.factor(SOFA_Positive), family = "binomial", 
##     data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.7680  -0.7680  -0.7680  -0.4393   2.1846  
## 
## Coefficients:
##                               Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                  -2.289758   0.007755  -295.3   <2e-16 ***
## as.factor(SOFA_Positive)TRUE  1.219750   0.008491   143.7   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 647128  on 638756  degrees of freedom
## Residual deviance: 621940  on 638755  degrees of freedom
## AIC: 621944
## 
## Number of Fisher Scoring iterations: 4
ssd_incl_te$SOFA2CrudeSepsisPred <- predict(SOFA2_Crude_Sepsis_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")
library(sjPlot)
library(ROCR)

SOFA2CrudeSepsis.Pred <- prediction(ssd_incl_te$SOFA2CrudeSepsisPred, ssd_incl_te$sepsis_outcome)
SOFA2CrudeSepsis.Perf <- performance(SOFA2CrudeSepsis.Pred, "tpr", "fpr")
plot(SOFA2CrudeSepsis.Perf, main = "SOFA Positive Crude Sepsis Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(SOFA2CrudeSepsis.Pred,"auc")@y.values[[1]],3))) 

performance(SOFA2CrudeSepsis.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.6087716
## 
## 
## Slot "alpha.values":
## list()
SOFA2CrudeSepsis.Pred.roc <- roc(sepsis_outcome~SOFA2CrudeSepsisPred,data=ssd_incl_te)
ci(SOFA2CrudeSepsis.Pred.roc, conf.level=0.99)
## 99% CI: 0.6065-0.6111 (DeLong)
ggplot(calibration(as.factor(!sepsis_outcome)~SOFA2CrudeSepsisPred, data = ssd_incl_te))+ggtitle("Calibration of SOFA Positive Sepsis Prediction")
## Warning: Removed 9 rows containing missing values (geom_errorbar).

qplot(SOFA2CrudeSepsisPred, data = ssd_incl_te)+ggtitle("Histogram of SOFA Positive Sepsis Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

SOFA3_Crude_Sepsis_tr<-glm(sepsis_outcome ~ as.factor(SOFA_Positive2), data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(SOFA3_Crude_Sepsis_tr)
#sjt.glm(SOFA3_Crude_Sepsis_tr)

#drop1(SOFA3_Crude_Sepsis_tr,test="Chisq")

summary(SOFA3_Crude_Sepsis_tr)
## 
## Call:
## glm(formula = sepsis_outcome ~ as.factor(SOFA_Positive2), family = "binomial", 
##     data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.7663  -0.7663  -0.7663  -0.4193   2.2250  
## 
## Coefficients:
##                                Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                   -2.387468   0.008324  -286.8   <2e-16 ***
## as.factor(SOFA_Positive2)TRUE  1.312243   0.008998   145.8   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 647128  on 638756  degrees of freedom
## Residual deviance: 620236  on 638755  degrees of freedom
## AIC: 620240
## 
## Number of Fisher Scoring iterations: 5
ssd_incl_te$SOFA3CrudeSepsisPred <- predict(SOFA3_Crude_Sepsis_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")
library(sjPlot)
library(ROCR)

SOFA3CrudeSepsis.Pred <- prediction(ssd_incl_te$SOFA3CrudeSepsisPred, ssd_incl_te$sepsis_outcome)
SOFA3CrudeSepsis.Perf <- performance(SOFA3CrudeSepsis.Pred, "tpr", "fpr")
plot(SOFA3CrudeSepsis.Perf, main = "SOFA Positive w/o Baseline 
     Crude Sepsis Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(SOFA3CrudeSepsis.Pred,"auc")@y.values[[1]],3))) 

performance(SOFA3CrudeSepsis.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.6088949
## 
## 
## Slot "alpha.values":
## list()
SOFA3CrudeSepsis.Pred.roc <- roc(sepsis_outcome~SOFA3CrudeSepsisPred,data=ssd_incl_te)
ci(SOFA3CrudeSepsis.Pred.roc, conf.level=0.99)
## 99% CI: 0.6067-0.6111 (DeLong)
ggplot(calibration(as.factor(!sepsis_outcome)~SOFA3CrudeSepsisPred, data = ssd_incl_te))+ggtitle("Calibration of SOFA Positive w/o Baseline Sepsis Prediction")
## Warning: Removed 9 rows containing missing values (geom_errorbar).

qplot(SOFA3CrudeSepsisPred, data = ssd_incl_te)+ggtitle("Histogram of SOFA Positive w/o Baseline Sepsis Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

FuzzyLogic_Crude_Sepsis_tr<-glm(sepsis_outcome ~ (SepsisFuzzyLogicPositive), data=ssd_incl_tr,family="binomial",na.action = na.omit)

#sjp.glm(FuzzyLogic_ADJ_Sepsis_tr)
#sjt.glm(FuzzyLogic_ADJ_Sepsis_tr)

#drop1(FuzzyLogic_ADJ_Sepsis_tr,test="Chisq")

summary(FuzzyLogic_ADJ_Sepsis_tr)
## 
## Call:
## glm(formula = sepsis_outcome ~ (SepsisFuzzyLogicPositive) + age_Ranges + 
##     gender2 + ethnicity2 + BMI_Ranges + icu_admit_source2 + hospital_teaching_status + 
##     hospital_size + physicianSpeciality2 + hospitaldischargeyear + 
##     dialysis + aids + hepaticfailure + diabetes + immunosuppression + 
##     leukemia + lymphoma + metastaticcancer + thrombolytics + 
##     sofa_respiration_baseline2 + cardiovascular_baseline, family = "binomial", 
##     data = ssd_incl_tr, na.action = na.omit)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.0787  -0.7206  -0.4234  -0.1814   3.6169  
## 
## Coefficients:
##                                        Estimate Std. Error  z value
## (Intercept)                           -2.124152   0.033816  -62.815
## SepsisFuzzyLogicPositiveTRUE           1.494644   0.007929  188.497
## age_Ranges(25,35]                      0.200047   0.027507    7.272
## age_Ranges(35,45]                      0.380838   0.025582   14.887
## age_Ranges(45,55]                      0.539099   0.023648   22.797
## age_Ranges(55,65]                      0.710904   0.023120   30.748
## age_Ranges(65,75]                      0.744332   0.023110   32.209
## age_Ranges(75,85]                      0.822203   0.023233   35.390
## age_Ranges(85,100]                     0.957012   0.024461   39.125
## gender2Female                          0.036346   0.006828    5.323
## gender2Other/Unknown                  -1.078963   0.267177   -4.038
## ethnicity2African American            -0.029079   0.011073   -2.626
## ethnicity2Hispanic                     0.399012   0.015308   26.065
## ethnicity2Asian                        0.110971   0.029812    3.722
## ethnicity2Native American              0.266320   0.037867    7.033
## ethnicity2Other/Unknown                0.046935   0.014927    3.144
## BMI_Ranges(18.5,25]                   -0.220140   0.015229  -14.455
## BMI_Ranges(25,35]                     -0.286701   0.014915  -19.222
## BMI_Ranges(35,200]                    -0.114540   0.016172   -7.083
## BMI_RangesOther/Unknown               -0.465796   0.023828  -19.548
## icu_admit_source2OR/Proc Area         -1.996615   0.014573 -137.012
## icu_admit_source2Direct Admit         -0.459874   0.012939  -35.543
## icu_admit_source2Emergency Department -0.280337   0.008454  -33.161
## icu_admit_source2Other                -0.107824   0.033765   -3.193
## icu_admit_source2Step-Down Unit        0.055622   0.021391    2.600
## hospital_teaching_statusf             -0.240214   0.024886   -9.652
## hospital_teaching_statust             -0.207117   0.025137   -8.240
## hospital_size<100                      0.621431   0.023826   26.082
## hospital_size100-249                   0.311101   0.019367   16.063
## hospital_size250-500                   0.262875   0.019696   13.346
## hospital_size>500                      0.108788   0.018436    5.901
## physicianSpeciality2Speciality-Other  -0.501852   0.007684  -65.313
## hospitaldischargeyear2011              0.092410   0.013172    7.016
## hospitaldischargeyear2012             -0.039503   0.012781   -3.091
## hospitaldischargeyear2013             -0.038688   0.012491   -3.097
## hospitaldischargeyear2014             -0.059266   0.012397   -4.781
## hospitaldischargeyear2015-16          -0.019868   0.012269   -1.619
## dialysis1                              0.270859   0.017788   15.227
## aids1                                  1.331422   0.089546   14.869
## hepaticfailureTRUE                    -0.029653   0.021485   -1.380
## diabetes1                              0.044792   0.008428    5.315
## immunosuppression1                     0.526333   0.020537   25.628
## leukemia1                              0.399091   0.034129   11.694
## lymphoma1                              0.345324   0.046675    7.399
## metastaticcancer1                      0.019801   0.024233    0.817
## thrombolytics1                        -2.110673   0.060512  -34.880
## sofa_respiration_baseline2TRUE         0.392935   0.007544   52.086
## cardiovascular_baseline1              -0.072916   0.008255   -8.833
##                                       Pr(>|z|)    
## (Intercept)                            < 2e-16 ***
## SepsisFuzzyLogicPositiveTRUE           < 2e-16 ***
## age_Ranges(25,35]                     3.53e-13 ***
## age_Ranges(35,45]                      < 2e-16 ***
## age_Ranges(45,55]                      < 2e-16 ***
## age_Ranges(55,65]                      < 2e-16 ***
## age_Ranges(65,75]                      < 2e-16 ***
## age_Ranges(75,85]                      < 2e-16 ***
## age_Ranges(85,100]                     < 2e-16 ***
## gender2Female                         1.02e-07 ***
## gender2Other/Unknown                  5.38e-05 ***
## ethnicity2African American            0.008635 ** 
## ethnicity2Hispanic                     < 2e-16 ***
## ethnicity2Asian                       0.000197 ***
## ethnicity2Native American             2.02e-12 ***
## ethnicity2Other/Unknown               0.001665 ** 
## BMI_Ranges(18.5,25]                    < 2e-16 ***
## BMI_Ranges(25,35]                      < 2e-16 ***
## BMI_Ranges(35,200]                    1.41e-12 ***
## BMI_RangesOther/Unknown                < 2e-16 ***
## icu_admit_source2OR/Proc Area          < 2e-16 ***
## icu_admit_source2Direct Admit          < 2e-16 ***
## icu_admit_source2Emergency Department  < 2e-16 ***
## icu_admit_source2Other                0.001406 ** 
## icu_admit_source2Step-Down Unit       0.009314 ** 
## hospital_teaching_statusf              < 2e-16 ***
## hospital_teaching_statust              < 2e-16 ***
## hospital_size<100                      < 2e-16 ***
## hospital_size100-249                   < 2e-16 ***
## hospital_size250-500                   < 2e-16 ***
## hospital_size>500                     3.61e-09 ***
## physicianSpeciality2Speciality-Other   < 2e-16 ***
## hospitaldischargeyear2011             2.29e-12 ***
## hospitaldischargeyear2012             0.001996 ** 
## hospitaldischargeyear2013             0.001952 ** 
## hospitaldischargeyear2014             1.75e-06 ***
## hospitaldischargeyear2015-16          0.105359    
## dialysis1                              < 2e-16 ***
## aids1                                  < 2e-16 ***
## hepaticfailureTRUE                    0.167532    
## diabetes1                             1.07e-07 ***
## immunosuppression1                     < 2e-16 ***
## leukemia1                              < 2e-16 ***
## lymphoma1                             1.38e-13 ***
## metastaticcancer1                     0.413868    
## thrombolytics1                         < 2e-16 ***
## sofa_respiration_baseline2TRUE         < 2e-16 ***
## cardiovascular_baseline1               < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 647128  on 638756  degrees of freedom
## Residual deviance: 548492  on 638709  degrees of freedom
## AIC: 548588
## 
## Number of Fisher Scoring iterations: 6
ssd_incl_te$FuzzyLogicCrudeSepsisPred <- predict(FuzzyLogic_Crude_Sepsis_tr,newdata=ssd_incl_te,na.action=na.pass,type="response")
library(sjPlot)
library(ROCR)

FuzzyLogicCrudeSepsis.Pred <- prediction(ssd_incl_te$FuzzyLogicCrudeSepsisPred, ssd_incl_te$sepsis_outcome)
FuzzyLogicCrudeSepsis.Perf <- performance(FuzzyLogicCrudeSepsis.Pred, "tpr", "fpr")
plot(FuzzyLogicCrudeSepsis.Perf, main = "FuzzyLogic Positive Crude Sepsis Prediction Test Model")
text(0.7,0.2,label=paste0("AUC:",round(performance(FuzzyLogicCrudeSepsis.Pred,"auc")@y.values[[1]],3))) 

performance(FuzzyLogicCrudeSepsis.Pred, "auc")
## An object of class "performance"
## Slot "x.name":
## [1] "None"
## 
## Slot "y.name":
## [1] "Area under the ROC curve"
## 
## Slot "alpha.name":
## [1] "none"
## 
## Slot "x.values":
## list()
## 
## Slot "y.values":
## [[1]]
## [1] 0.6665731
## 
## 
## Slot "alpha.values":
## list()
FuzzyLogicCrudeSepsis.Pred.roc <- roc(sepsis_outcome~FuzzyLogicCrudeSepsisPred,data=ssd_incl_te)
ci(FuzzyLogicCrudeSepsis.Pred.roc, conf.level=0.99)
## 99% CI: 0.6641-0.6691 (DeLong)
ggplot(calibration(as.factor(!sepsis_outcome)~FuzzyLogicCrudeSepsisPred, data = ssd_incl_te))+ggtitle("Calibration of FuzzyLogic Positive Sepsis Prediction")
## Warning: Removed 9 rows containing missing values (geom_errorbar).

qplot(FuzzyLogicCrudeSepsisPred, data = ssd_incl_te)+ggtitle("Histogram of FuzzyLogic Positive Sepsis Predictions")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

23 Setting up variables to analyze interactions

ssd_incl_te <- ssd_incl_te %>% mutate(SIRS2TruthSepsis=interaction (SIRS_Positive,sepsis_outcome))
ssd_incl_te <- ssd_incl_te %>% mutate(qSOFA2TruthSepsis=interaction (qSOFA_Positive,sepsis_outcome))
ssd_incl_te <- ssd_incl_te %>% mutate(SOFA2TruthSepsis=interaction (SOFA_Positive,sepsis_outcome))
ssd_incl_te <- ssd_incl_te %>% mutate(FuzzyLogicTruthSepsis=interaction (SepsisFuzzyLogicPositive,sepsis_outcome))
vars5 <- c("age_Ranges", "gender2", "ethnicity2", "BMI_Ranges", "physicianSpeciality2", "icu_admit_source2", "icu_disch_location2", "hospitaldischargeyear", "dischargelocation", "dialysis", "aids", "hepaticfailure",  "diabetes",  "immunosuppression" , "leukemia", "lymphoma", "metastaticcancer", "thrombolytics", "sofa_respiration_baseline2", "sofa_liver_baseline2", "sofa_renal_baseline2", "cardiovascular_baseline", "group" )

library(dplyr); library(Hmisc); library(ggplot2); #library(sjPlot)

if(!("tableone" %in% rownames(installed.packages()))) {
  install.packages("tableone")
}
library(dplyr); library(Hmisc); library(ggplot2); #library(sjPlot)
library(tableone)

CreateTableOne(data=ssd_incl_te ,vars=vars5,strata="SIRS2TruthSepsis",test=FALSE, includeNA=TRUE
) %>% print(nonnormal= c("sofa_respiration_baseline", "sofa_liver_baseline", "sofa_renal_baseline"),minMax=TRUE,
  printToggle      = FALSE,
  showAllLevels    = TRUE,
  cramVars         = "kon"
) %>%
{data.frame(
  variable_name             = gsub(" ", "&nbsp;", rownames(.), fixed = TRUE), .,                                                                                                                     
  row.names        = NULL,
  check.names      = FALSE,
  stringsAsFactors = FALSE)} %>%
  knitr::kable(caption="SIRS positive negative sepsis outcome")
SIRS positive negative sepsis outcome
variable_name level FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE
n 59019 158477 6200 50056
age_Ranges (%) (0,25] 1497 ( 2.5) 6467 ( 4.1) 50 ( 0.8) 1037 ( 2.1)
(25,35] 2487 ( 4.2) 9392 ( 5.9) 150 ( 2.4) 2031 ( 4.1)
(35,45] 3958 ( 6.7) 13094 ( 8.3) 246 ( 4.0) 3030 ( 6.1)
(45,55] 8810 ( 14.9) 24376 (15.4) 803 (13.0) 6540 (13.1)
(55,65] 12717 ( 21.5) 32813 (20.7) 1288 (20.8) 10286 (20.5)
(65,75] 13662 ( 23.1) 33702 (21.3) 1517 (24.5) 11725 (23.4)
(75,85] 11188 ( 19.0) 26913 (17.0) 1418 (22.9) 10103 (20.2)
(85,100] 4700 ( 8.0) 11720 ( 7.4) 728 (11.7) 5304 (10.6)
gender2 (%) Male 33335 ( 56.5) 85328 (53.8) 3126 (50.4) 25113 (50.2)
Female 25670 ( 43.5) 73095 (46.1) 3074 (49.6) 24931 (49.8)
Other/Unknown 14 ( 0.0) 54 ( 0.0) 0 ( 0.0) 12 ( 0.0)
ethnicity2 (%) Caucasian 44895 ( 76.1) 121150 (76.4) 4622 (74.5) 38021 (76.0)
African American 6653 ( 11.3) 18953 (12.0) 674 (10.9) 5449 (10.9)
Hispanic 2668 ( 4.5) 6357 ( 4.0) 410 ( 6.6) 2850 ( 5.7)
Asian 761 ( 1.3) 2024 ( 1.3) 84 ( 1.4) 664 ( 1.3)
Native American 407 ( 0.7) 1151 ( 0.7) 53 ( 0.9) 401 ( 0.8)
Other/Unknown 3635 ( 6.2) 8842 ( 5.6) 357 ( 5.8) 2671 ( 5.3)
BMI_Ranges (%) (0,18.5] 2204 ( 3.7) 7542 ( 4.8) 331 ( 5.3) 3371 ( 6.7)
(18.5,25] 15631 ( 26.5) 44539 (28.1) 1693 (27.3) 15012 (30.0)
(25,35] 29041 ( 49.2) 72828 (46.0) 2588 (41.7) 20755 (41.5)
(35,200] 9515 ( 16.1) 28123 (17.7) 1352 (21.8) 9467 (18.9)
Other/Unknown 2628 ( 4.5) 5445 ( 3.4) 236 ( 3.8) 1451 ( 2.9)
physicianSpeciality2 (%) Critical Care 11115 ( 18.8) 47303 (29.8) 2028 (32.7) 19849 (39.7)
Speciality-Other 47904 ( 81.2) 111174 (70.2) 4172 (67.3) 30207 (60.3)
icu_admit_source2 (%) Floor 7769 ( 13.2) 24660 (15.6) 1460 (23.5) 12545 (25.1)
OR/Proc Area 11280 ( 19.1) 38657 (24.4) 279 ( 4.5) 2715 ( 5.4)
Direct Admit 7535 ( 12.8) 16746 (10.6) 483 ( 7.8) 4707 ( 9.4)
Emergency Department 31279 ( 53.0) 73813 (46.6) 3755 (60.6) 27827 (55.6)
Other 361 ( 0.6) 1361 ( 0.9) 55 ( 0.9) 583 ( 1.2)
Step-Down Unit 795 ( 1.3) 3240 ( 2.0) 168 ( 2.7) 1679 ( 3.4)
icu_disch_location2 (%) Floor 41911 ( 71.0) 117529 (74.2) 4876 (78.6) 35103 (70.1)
Death 775 ( 1.3) 10088 ( 6.4) 309 ( 5.0) 7183 (14.3)
Home 11221 ( 19.0) 13662 ( 8.6) 330 ( 5.3) 1470 ( 2.9)
SNF/Rehab 653 ( 1.1) 1995 ( 1.3) 195 ( 3.1) 1415 ( 2.8)
Other 1545 ( 2.6) 5027 ( 3.2) 197 ( 3.2) 2036 ( 4.1)
Other Hospital 1223 ( 2.1) 3434 ( 2.2) 144 ( 2.3) 1355 ( 2.7)
Step-Down Unit 1691 ( 2.9) 6742 ( 4.3) 149 ( 2.4) 1494 ( 3.0)
hospitaldischargeyear (%) -2010 8182 ( 13.9) 18265 (11.5) 797 (12.9) 6104 (12.2)
2011 8248 ( 14.0) 20448 (12.9) 938 (15.1) 7180 (14.3)
2012 9659 ( 16.4) 26048 (16.4) 950 (15.3) 8153 (16.3)
2013 10589 ( 17.9) 29524 (18.6) 1097 (17.7) 9052 (18.1)
2014 11459 ( 19.4) 31504 (19.9) 1231 (19.9) 9357 (18.7)
2015-16 10882 ( 18.4) 32688 (20.6) 1187 (19.1) 10210 (20.4)
dischargelocation (mean (sd)) 5.23 (1.68) 5.30 (1.86) 5.01 (1.73) 5.43 (2.05)
dialysis (%) 0 57032 ( 96.6) 153514 (96.9) 5861 (94.5) 48087 (96.1)
1 1987 ( 3.4) 4963 ( 3.1) 339 ( 5.5) 1969 ( 3.9)
aids (%) 0 58999 (100.0) 158392 (99.9) 6187 (99.8) 49911 (99.7)
1 20 ( 0.0) 85 ( 0.1) 13 ( 0.2) 145 ( 0.3)
hepaticfailure (%) FALSE 58024 ( 98.3) 155221 (97.9) 6031 (97.3) 48795 (97.5)
TRUE 995 ( 1.7) 3256 ( 2.1) 169 ( 2.7) 1261 ( 2.5)
diabetes (%) 0 46071 ( 78.1) 123897 (78.2) 4557 (73.5) 39395 (78.7)
1 12948 ( 21.9) 34580 (21.8) 1643 (26.5) 10661 (21.3)
immunosuppression (%) 0 58280 ( 98.7) 155067 (97.8) 6026 (97.2) 48013 (95.9)
1 739 ( 1.3) 3410 ( 2.2) 174 ( 2.8) 2043 ( 4.1)
leukemia (%) 0 58808 ( 99.6) 157498 (99.4) 6156 (99.3) 49352 (98.6)
1 211 ( 0.4) 979 ( 0.6) 44 ( 0.7) 704 ( 1.4)
lymphoma (%) 0 58868 ( 99.7) 157942 (99.7) 6177 (99.6) 49735 (99.4)
1 151 ( 0.3) 535 ( 0.3) 23 ( 0.4) 321 ( 0.6)
metastaticcancer (%) 0 58219 ( 98.6) 155333 (98.0) 6102 (98.4) 48792 (97.5)
1 800 ( 1.4) 3144 ( 2.0) 98 ( 1.6) 1264 ( 2.5)
thrombolytics (%) 0 57043 ( 96.7) 155581 (98.2) 6193 (99.9) 49967 (99.8)
1 1976 ( 3.3) 2896 ( 1.8) 7 ( 0.1) 89 ( 0.2)
sofa_respiration_baseline2 (%) FALSE 48496 ( 82.2) 122329 (77.2) 3953 (63.8) 33230 (66.4)
TRUE 10523 ( 17.8) 36148 (22.8) 2247 (36.2) 16826 (33.6)
sofa_liver_baseline2 (%) FALSE 58024 ( 98.3) 155221 (97.9) 6031 (97.3) 48795 (97.5)
TRUE 995 ( 1.7) 3256 ( 2.1) 169 ( 2.7) 1261 ( 2.5)
sofa_renal_baseline2 (%) FALSE 57032 ( 96.6) 153514 (96.9) 5861 (94.5) 48087 (96.1)
TRUE 1987 ( 3.4) 4963 ( 3.1) 339 ( 5.5) 1969 ( 3.9)
cardiovascular_baseline (%) 0 44589 ( 75.6) 124723 (78.7) 4265 (68.8) 38284 (76.5)
1 14430 ( 24.4) 33754 (21.3) 1935 (31.2) 11772 (23.5)
group (%) Cardiovascular 26820 ( 45.4) 55465 (35.0) 830 (13.4) 5248 (10.5)
Gastrointestinal 5558 ( 9.4) 19470 (12.3) 348 ( 5.6) 3168 ( 6.3)
Gynaecological 103 ( 0.2) 579 ( 0.4) 2 ( 0.0) 31 ( 0.1)
Hematological 396 ( 0.7) 1383 ( 0.9) 33 ( 0.5) 274 ( 0.5)
Metabolic 5526 ( 9.4) 15086 ( 9.5) 297 ( 4.8) 1552 ( 3.1)
Muscoskeletal/Skin disease 649 ( 1.1) 2130 ( 1.3) 77 ( 1.2) 602 ( 1.2)
Neurological 10203 ( 17.3) 23845 (15.0) 457 ( 7.4) 2332 ( 4.7)
Renal/Genitourinary 1340 ( 2.3) 3749 ( 2.4) 231 ( 3.7) 1256 ( 2.5)
Respiratory 4715 ( 8.0) 22238 (14.0) 1629 (26.3) 12276 (24.5)
Sepsis 360 ( 0.6) 3890 ( 2.5) 2249 (36.3) 22838 (45.6)
Trauma 2883 ( 4.9) 8928 ( 5.6) 28 ( 0.5) 286 ( 0.6)
Undefined 466 ( 0.8) 1714 ( 1.1) 19 ( 0.3) 193 ( 0.4)
library(tidyr)
ssd_incl_te%>%group_by(hospitaldischargeyear,SIRS2TruthSepsis) %>%summarise(n=n())%>%spread(SIRS2TruthSepsis,n)%>%mutate(SENS=TRUE.TRUE/(TRUE.TRUE+FALSE.TRUE),SPEC=FALSE.FALSE/(FALSE.FALSE+TRUE.FALSE))%>%knitr::kable()
hospitaldischargeyear FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE SENS SPEC
-2010 8182 18265 797 6104 0.8845095 0.3093735
2011 8248 20448 938 7180 0.8844543 0.2874268
2012 9659 26048 950 8153 0.8956388 0.2705072
2013 10589 29524 1097 9052 0.8919105 0.2639793
2014 11459 31504 1231 9357 0.8837363 0.2667179
2015-16 10882 32688 1187 10210 0.8958498 0.2497590
ssd_incl_te%>%group_by(hospitaldischargeyear,SIRS2TruthSepsis) %>%summarise(n=n())%>%spread(SIRS2TruthSepsis,n)%>%head()
## # A tibble: 6 x 5
## # Groups:   hospitaldischargeyear [6]
##   hospitaldischargeyear FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE
##   <chr>                       <int>      <int>      <int>     <int>
## 1 -2010                        8182      18265        797      6104
## 2 2011                         8248      20448        938      7180
## 3 2012                         9659      26048        950      8153
## 4 2013                        10589      29524       1097      9052
## 5 2014                        11459      31504       1231      9357
## 6 2015-16                     10882      32688       1187     10210
ssd_incl_te%>%group_by(age_Ranges,SIRS2TruthSepsis) %>%summarise(n=n())%>%spread(SIRS2TruthSepsis,n)%>%mutate(SENS=TRUE.TRUE/(TRUE.TRUE+FALSE.TRUE),SPEC=FALSE.FALSE/(FALSE.FALSE+TRUE.FALSE))%>%knitr::kable()
age_Ranges FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE SENS SPEC
(0,25] 1497 6467 50 1037 0.9540018 0.1879709
(25,35] 2487 9392 150 2031 0.9312242 0.2093611
(35,45] 3958 13094 246 3030 0.9249084 0.2321135
(45,55] 8810 24376 803 6540 0.8906442 0.2654734
(55,65] 12717 32813 1288 10286 0.8887161 0.2793103
(65,75] 13662 33702 1517 11725 0.8854403 0.2884469
(75,85] 11188 26913 1418 10103 0.8769204 0.2936406
(85,100] 4700 11720 728 5304 0.8793103 0.2862363
ssd_incl_te%>%group_by(BMI_Ranges,SIRS2TruthSepsis) %>%summarise(n=n())%>%spread(SIRS2TruthSepsis,n)%>%mutate(SENS=TRUE.TRUE/(TRUE.TRUE+FALSE.TRUE),SPEC=FALSE.FALSE/(FALSE.FALSE+TRUE.FALSE))%>%knitr::kable()
BMI_Ranges FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE SENS SPEC
(0,18.5] 2204 7542 331 3371 0.9105889 0.2261441
(18.5,25] 15631 44539 1693 15012 0.8986531 0.2597806
(25,35] 29041 72828 2588 20755 0.8891316 0.2850818
(35,200] 9515 28123 1352 9467 0.8750347 0.2528030
Other/Unknown 2628 5445 236 1451 0.8601067 0.3255295
ssd_incl_te%>%group_by(icu_admit_source2,SIRS2TruthSepsis) %>%summarise(n=n())%>%spread(SIRS2TruthSepsis,n)%>%mutate(SENS=TRUE.TRUE/(TRUE.TRUE+FALSE.TRUE),SPEC=FALSE.FALSE/(FALSE.FALSE+TRUE.FALSE))%>%knitr::kable()
icu_admit_source2 FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE SENS SPEC
Floor 7769 24660 1460 12545 0.8957515 0.2395695
OR/Proc Area 11280 38657 279 2715 0.9068136 0.2258846
Direct Admit 7535 16746 483 4707 0.9069364 0.3103249
Emergency Department 31279 73813 3755 27827 0.8811032 0.2976345
Other 361 1361 55 583 0.9137931 0.2096400
Step-Down Unit 795 3240 168 1679 0.9090417 0.1970260
ssd_incl_te%>%group_by(ethnicity2,SIRS2TruthSepsis) %>%summarise(n=n())%>%spread(SIRS2TruthSepsis,n)%>%mutate(SENS=TRUE.TRUE/(TRUE.TRUE+FALSE.TRUE),SPEC=FALSE.FALSE/(FALSE.FALSE+TRUE.FALSE))%>%knitr::kable()
ethnicity2 FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE SENS SPEC
Caucasian 44895 121150 4622 38021 0.8916118 0.2703785
African American 6653 18953 674 5449 0.8899232 0.2598219
Hispanic 2668 6357 410 2850 0.8742331 0.2956233
Asian 761 2024 84 664 0.8877005 0.2732496
Native American 407 1151 53 401 0.8832599 0.2612323
Other/Unknown 3635 8842 357 2671 0.8821004 0.2913361
ssd_incl_te%>%group_by(physicianSpeciality2,SIRS2TruthSepsis) %>%summarise(n=n())%>%spread(SIRS2TruthSepsis,n)%>%mutate(SENS=TRUE.TRUE/(TRUE.TRUE+FALSE.TRUE),SPEC=FALSE.FALSE/(FALSE.FALSE+TRUE.FALSE))%>%knitr::kable()
physicianSpeciality2 FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE SENS SPEC
Critical Care 11115 47303 2028 19849 0.9072999 0.1902667
Speciality-Other 47904 111174 4172 30207 0.8786468 0.3011353
vars5 <- c("age_Ranges", "gender2", "ethnicity2", "BMI_Ranges", "physicianSpeciality2", "icu_admit_source2", "icu_disch_location2", "hospitaldischargeyear", "dischargelocation", "dialysis", "aids", "hepaticfailure", "diabetes",  "immunosuppression" , "leukemia", "lymphoma", "metastaticcancer", "thrombolytics", "sofa_respiration_baseline2", "sofa_liver_baseline2", "sofa_renal_baseline2", "cardiovascular_baseline", "group" )

library(dplyr); library(Hmisc); library(ggplot2); #library(sjPlot)

if(!("tableone" %in% rownames(installed.packages()))) {
  install.packages("tableone")
}
library(dplyr); library(Hmisc); library(ggplot2); #library(sjPlot)
library(tableone)

CreateTableOne(data=ssd_incl_te ,vars=vars5,strata="qSOFA2TruthSepsis",test=FALSE, includeNA=TRUE
) %>% print(nonnormal= c("sofa_respiration_baseline", "sofa_liver_baseline", "sofa_renal_baseline"),minMax=TRUE,
  printToggle      = FALSE,
  showAllLevels    = TRUE,
  cramVars         = "kon"
) %>%
{data.frame(
  variable_name             = gsub(" ", "&nbsp;", rownames(.), fixed = TRUE), .,                                                                                                                     
  row.names        = NULL,
  check.names      = FALSE,
  stringsAsFactors = FALSE)} %>%
  knitr::kable(caption="qSOFA positive negative sepsis_outcome")
qSOFA positive negative sepsis_outcome
variable_name level FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE
n 79553 137943 10133 46123
age_Ranges (%) (0,25] 3156 ( 4.0) 4808 ( 3.5) 247 ( 2.4) 840 ( 1.8)
(25,35] 4835 ( 6.1) 7044 ( 5.1) 511 ( 5.0) 1670 ( 3.6)
(35,45] 7038 ( 8.8) 10014 ( 7.3) 716 ( 7.1) 2560 ( 5.6)
(45,55] 12932 ( 16.3) 20254 ( 14.7) 1460 (14.4) 5883 (12.8)
(55,65] 17115 ( 21.5) 28415 ( 20.6) 2222 (21.9) 9352 (20.3)
(65,75] 17013 ( 21.4) 30351 ( 22.0) 2375 (23.4) 10867 (23.6)
(75,85] 12777 ( 16.1) 25324 ( 18.4) 1842 (18.2) 9679 (21.0)
(85,100] 4687 ( 5.9) 11733 ( 8.5) 760 ( 7.5) 5272 (11.4)
gender2 (%) Male 45645 ( 57.4) 73018 ( 52.9) 5252 (51.8) 22987 (49.8)
Female 33886 ( 42.6) 64879 ( 47.0) 4880 (48.2) 23125 (50.1)
Other/Unknown 22 ( 0.0) 46 ( 0.0) 1 ( 0.0) 11 ( 0.0)
ethnicity2 (%) Caucasian 58577 ( 73.6) 107468 ( 77.9) 7447 (73.5) 35196 (76.3)
African American 10487 ( 13.2) 15119 ( 11.0) 1199 (11.8) 4924 (10.7)
Hispanic 3745 ( 4.7) 5280 ( 3.8) 682 ( 6.7) 2578 ( 5.6)
Asian 959 ( 1.2) 1826 ( 1.3) 138 ( 1.4) 610 ( 1.3)
Native American 562 ( 0.7) 996 ( 0.7) 73 ( 0.7) 381 ( 0.8)
Other/Unknown 5223 ( 6.6) 7254 ( 5.3) 594 ( 5.9) 2434 ( 5.3)
BMI_Ranges (%) (0,18.5] 2961 ( 3.7) 6785 ( 4.9) 542 ( 5.3) 3160 ( 6.9)
(18.5,25] 20564 ( 25.8) 39606 ( 28.7) 2685 (26.5) 14020 (30.4)
(25,35] 38762 ( 48.7) 63107 ( 45.7) 4337 (42.8) 19006 (41.2)
(35,200] 14063 ( 17.7) 23575 ( 17.1) 2212 (21.8) 8607 (18.7)
Other/Unknown 3203 ( 4.0) 4870 ( 3.5) 357 ( 3.5) 1330 ( 2.9)
physicianSpeciality2 (%) Critical Care 16452 ( 20.7) 41966 ( 30.4) 3171 (31.3) 18706 (40.6)
Speciality-Other 63101 ( 79.3) 95977 ( 69.6) 6962 (68.7) 27417 (59.4)
icu_admit_source2 (%) Floor 10198 ( 12.8) 22231 ( 16.1) 2449 (24.2) 11556 (25.1)
OR/Proc Area 17853 ( 22.4) 32084 ( 23.3) 626 ( 6.2) 2368 ( 5.1)
Direct Admit 9294 ( 11.7) 14987 ( 10.9) 794 ( 7.8) 4396 ( 9.5)
Emergency Department 40542 ( 51.0) 64550 ( 46.8) 5938 (58.6) 25644 (55.6)
Other 518 ( 0.7) 1204 ( 0.9) 91 ( 0.9) 547 ( 1.2)
Step-Down Unit 1148 ( 1.4) 2887 ( 2.1) 235 ( 2.3) 1612 ( 3.5)
icu_disch_location2 (%) Floor 58038 ( 73.0) 101402 ( 73.5) 8150 (80.4) 31829 (69.0)
Death 1085 ( 1.4) 9778 ( 7.1) 467 ( 4.6) 7025 (15.2)
Home 13244 ( 16.6) 11639 ( 8.4) 531 ( 5.2) 1269 ( 2.8)
SNF/Rehab 754 ( 0.9) 1894 ( 1.4) 198 ( 2.0) 1412 ( 3.1)
Other 1972 ( 2.5) 4600 ( 3.3) 299 ( 3.0) 1934 ( 4.2)
Other Hospital 1487 ( 1.9) 3170 ( 2.3) 248 ( 2.4) 1251 ( 2.7)
Step-Down Unit 2973 ( 3.7) 5460 ( 4.0) 240 ( 2.4) 1403 ( 3.0)
hospitaldischargeyear (%) -2010 11213 ( 14.1) 15234 ( 11.0) 1373 (13.5) 5528 (12.0)
2011 10956 ( 13.8) 17740 ( 12.9) 1466 (14.5) 6652 (14.4)
2012 12705 ( 16.0) 23002 ( 16.7) 1526 (15.1) 7577 (16.4)
2013 14050 ( 17.7) 26063 ( 18.9) 1728 (17.1) 8421 (18.3)
2014 15404 ( 19.4) 27559 ( 20.0) 2024 (20.0) 8564 (18.6)
2015-16 15225 ( 19.1) 28345 ( 20.5) 2016 (19.9) 9381 (20.3)
dischargelocation (mean (sd)) 5.15 (1.67) 5.35 (1.89) 4.91 (1.66) 5.49 (2.07)
dialysis (%) 0 76924 ( 96.7) 133622 ( 96.9) 9715 (95.9) 44233 (95.9)
1 2629 ( 3.3) 4321 ( 3.1) 418 ( 4.1) 1890 ( 4.1)
aids (%) 0 79514 (100.0) 137877 (100.0) 10100 (99.7) 45998 (99.7)
1 39 ( 0.0) 66 ( 0.0) 33 ( 0.3) 125 ( 0.3)
hepaticfailure (%) FALSE 78337 ( 98.5) 134908 ( 97.8) 9912 (97.8) 44914 (97.4)
TRUE 1216 ( 1.5) 3035 ( 2.2) 221 ( 2.2) 1209 ( 2.6)
diabetes (%) 0 61305 ( 77.1) 108663 ( 78.8) 7670 (75.7) 36282 (78.7)
1 18248 ( 22.9) 29280 ( 21.2) 2463 (24.3) 9841 (21.3)
immunosuppression (%) 0 78204 ( 98.3) 135143 ( 98.0) 9724 (96.0) 44315 (96.1)
1 1349 ( 1.7) 2800 ( 2.0) 409 ( 4.0) 1808 ( 3.9)
leukemia (%) 0 79172 ( 99.5) 137134 ( 99.4) 10005 (98.7) 45503 (98.7)
1 381 ( 0.5) 809 ( 0.6) 128 ( 1.3) 620 ( 1.3)
lymphoma (%) 0 79345 ( 99.7) 137465 ( 99.7) 10083 (99.5) 45829 (99.4)
1 208 ( 0.3) 478 ( 0.3) 50 ( 0.5) 294 ( 0.6)
metastaticcancer (%) 0 78252 ( 98.4) 135300 ( 98.1) 9908 (97.8) 44986 (97.5)
1 1301 ( 1.6) 2643 ( 1.9) 225 ( 2.2) 1137 ( 2.5)
thrombolytics (%) 0 77364 ( 97.2) 135260 ( 98.1) 10117 (99.8) 46043 (99.8)
1 2189 ( 2.8) 2683 ( 1.9) 16 ( 0.2) 80 ( 0.2)
sofa_respiration_baseline2 (%) FALSE 64499 ( 81.1) 106326 ( 77.1) 6459 (63.7) 30724 (66.6)
TRUE 15054 ( 18.9) 31617 ( 22.9) 3674 (36.3) 15399 (33.4)
sofa_liver_baseline2 (%) FALSE 78337 ( 98.5) 134908 ( 97.8) 9912 (97.8) 44914 (97.4)
TRUE 1216 ( 1.5) 3035 ( 2.2) 221 ( 2.2) 1209 ( 2.6)
sofa_renal_baseline2 (%) FALSE 76924 ( 96.7) 133622 ( 96.9) 9715 (95.9) 44233 (95.9)
TRUE 2629 ( 3.3) 4321 ( 3.1) 418 ( 4.1) 1890 ( 4.1)
cardiovascular_baseline (%) 0 63290 ( 79.6) 106022 ( 76.9) 7729 (76.3) 34820 (75.5)
1 16263 ( 20.4) 31921 ( 23.1) 2404 (23.7) 11303 (24.5)
group (%) Cardiovascular 32493 ( 40.8) 49792 ( 36.1) 1221 (12.0) 4857 (10.5)
Gastrointestinal 9231 ( 11.6) 15797 ( 11.5) 722 ( 7.1) 2794 ( 6.1)
Gynaecological 270 ( 0.3) 412 ( 0.3) 6 ( 0.1) 27 ( 0.1)
Hematological 736 ( 0.9) 1043 ( 0.8) 77 ( 0.8) 230 ( 0.5)
Metabolic 7826 ( 9.8) 12786 ( 9.3) 435 ( 4.3) 1414 ( 3.1)
Muscoskeletal/Skin disease 1066 ( 1.3) 1713 ( 1.2) 141 ( 1.4) 538 ( 1.2)
Neurological 11556 ( 14.5) 22492 ( 16.3) 464 ( 4.6) 2325 ( 5.0)
Renal/Genitourinary 1860 ( 2.3) 3229 ( 2.3) 336 ( 3.3) 1151 ( 2.5)
Respiratory 8318 ( 10.5) 18635 ( 13.5) 2640 (26.1) 11265 (24.4)
Sepsis 748 ( 0.9) 3502 ( 2.5) 3989 (39.4) 21098 (45.7)
Trauma 4584 ( 5.8) 7227 ( 5.2) 58 ( 0.6) 256 ( 0.6)
Undefined 865 ( 1.1) 1315 ( 1.0) 44 ( 0.4) 168 ( 0.4)
ssd_incl_te%>%group_by(hospitaldischargeyear,qSOFA2TruthSepsis) %>%summarise(n=n())%>%spread(qSOFA2TruthSepsis,n)%>%mutate(SENS=TRUE.TRUE/(TRUE.TRUE+FALSE.TRUE),SPEC=FALSE.FALSE/(FALSE.FALSE+TRUE.FALSE))%>%knitr::kable()
hospitaldischargeyear FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE SENS SPEC
-2010 11213 15234 1373 5528 0.8010433 0.4239800
2011 10956 17740 1466 6652 0.8194136 0.3817954
2012 12705 23002 1526 7577 0.8323630 0.3558126
2013 14050 26063 1728 8421 0.8297369 0.3502605
2014 15404 27559 2024 8564 0.8088402 0.3585411
2015-16 15225 28345 2016 9381 0.8231113 0.3494377
ssd_incl_te%>%group_by(age_Ranges,qSOFA2TruthSepsis) %>%summarise(n=n())%>%spread(qSOFA2TruthSepsis,n)%>%mutate(SENS=TRUE.TRUE/(TRUE.TRUE+FALSE.TRUE),SPEC=FALSE.FALSE/(FALSE.FALSE+TRUE.FALSE))%>%knitr::kable()
age_Ranges FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE SENS SPEC
(0,25] 3156 4808 247 840 0.7727691 0.3962833
(25,35] 4835 7044 511 1670 0.7657038 0.4070208
(35,45] 7038 10014 716 2560 0.7814408 0.4127375
(45,55] 12932 20254 1460 5883 0.8011712 0.3896824
(55,65] 17115 28415 2222 9352 0.8080180 0.3759060
(65,75] 17013 30351 2375 10867 0.8206464 0.3591969
(75,85] 12777 25324 1842 9679 0.8401180 0.3353455
(85,100] 4687 11733 760 5272 0.8740053 0.2854446
ssd_incl_te%>%group_by(BMI_Ranges,qSOFA2TruthSepsis) %>%summarise(n=n())%>%spread(qSOFA2TruthSepsis,n)%>%mutate(SENS=TRUE.TRUE/(TRUE.TRUE+FALSE.TRUE),SPEC=FALSE.FALSE/(FALSE.FALSE+TRUE.FALSE))%>%knitr::kable()
BMI_Ranges FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE SENS SPEC
(0,18.5] 2961 6785 542 3160 0.8535927 0.3038170
(18.5,25] 20564 39606 2685 14020 0.8392697 0.3417650
(25,35] 38762 63107 4337 19006 0.8142055 0.3805083
(35,200] 14063 23575 2212 8607 0.7955449 0.3736383
Other/Unknown 3203 4870 357 1330 0.7883817 0.3967546
ssd_incl_te%>%group_by(icu_admit_source2,qSOFA2TruthSepsis) %>%summarise(n=n())%>%spread(qSOFA2TruthSepsis,n)%>%mutate(SENS=TRUE.TRUE/(TRUE.TRUE+FALSE.TRUE),SPEC=FALSE.FALSE/(FALSE.FALSE+TRUE.FALSE))%>%knitr::kable()
icu_admit_source2 FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE SENS SPEC
Floor 10198 22231 2449 11556 0.8251339 0.3144716
OR/Proc Area 17853 32084 626 2368 0.7909152 0.3575105
Direct Admit 9294 14987 794 4396 0.8470135 0.3827684
Emergency Department 40542 64550 5938 25644 0.8119815 0.3857763
Other 518 1204 91 547 0.8573668 0.3008130
Step-Down Unit 1148 2887 235 1612 0.8727666 0.2845105
ssd_incl_te%>%group_by(ethnicity2,qSOFA2TruthSepsis) %>%summarise(n=n())%>%spread(qSOFA2TruthSepsis,n)%>%mutate(SENS=TRUE.TRUE/(TRUE.TRUE+FALSE.TRUE),SPEC=FALSE.FALSE/(FALSE.FALSE+TRUE.FALSE))%>%knitr::kable()
ethnicity2 FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE SENS SPEC
Caucasian 58577 107468 7447 35196 0.8253641 0.3527779
African American 10487 15119 1199 4924 0.8041810 0.4095524
Hispanic 3745 5280 682 2578 0.7907975 0.4149584
Asian 959 1826 138 610 0.8155080 0.3443447
Native American 562 996 73 381 0.8392070 0.3607189
Other/Unknown 5223 7254 594 2434 0.8038309 0.4186102
ssd_incl_te%>%group_by(physicianSpeciality2,qSOFA2TruthSepsis) %>%summarise(n=n())%>%spread(qSOFA2TruthSepsis,n)%>%mutate(SENS=TRUE.TRUE/(TRUE.TRUE+FALSE.TRUE),SPEC=FALSE.FALSE/(FALSE.FALSE+TRUE.FALSE))%>%knitr::kable()
physicianSpeciality2 FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE SENS SPEC
Critical Care 16452 41966 3171 18706 0.8550533 0.2816255
Speciality-Other 63101 95977 6962 27417 0.7974927 0.3966670
vars5 <- c("age_Ranges", "gender2", "ethnicity2", "BMI_Ranges", "physicianSpeciality2", "icu_admit_source2", "icu_disch_location2", "hospitaldischargeyear", "dischargelocation", "dialysis", "aids", "hepaticfailure",  "diabetes",  "immunosuppression" , "leukemia", "lymphoma", "metastaticcancer", "thrombolytics", "sofa_respiration_baseline2", "sofa_liver_baseline2", "sofa_renal_baseline2", "cardiovascular_baseline", "group" )

library(dplyr); library(Hmisc); library(ggplot2); #library(sjPlot)

if(!("tableone" %in% rownames(installed.packages()))) {
  install.packages("tableone")
}
library(dplyr); library(Hmisc); library(ggplot2); #library(sjPlot)
library(tableone)

CreateTableOne(data=ssd_incl_te ,vars=vars5,strata="SOFA2TruthSepsis",test=FALSE, includeNA=TRUE
) %>% print(nonnormal= c("sofa_respiration_baseline", "sofa_liver_baseline", "sofa_renal_baseline"),minMax=TRUE,
  printToggle      = FALSE,
  showAllLevels    = TRUE,
  cramVars         = "kon"
) %>%
{data.frame(
  variable_name             = gsub(" ", "&nbsp;", rownames(.), fixed = TRUE), .,                                                                                                                     
  row.names        = NULL,
  check.names      = FALSE,
  stringsAsFactors = FALSE)} %>%
  knitr::kable(caption="SOFA positive negative sepsis outcome")
SOFA positive negative sepsis outcome
variable_name level FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE
n 77471 140025 7800 48456
age_Ranges (%) (0,25] 3772 ( 4.9) 4192 ( 3.0) 262 ( 3.4) 825 ( 1.7)
(25,35] 5346 ( 6.9) 6533 ( 4.7) 501 ( 6.4) 1680 ( 3.5)
(35,45] 7772 ( 10.0) 9280 ( 6.6) 609 ( 7.8) 2667 ( 5.5)
(45,55] 13955 ( 18.0) 19231 (13.7) 1226 (15.7) 6117 (12.6)
(55,65] 16991 ( 21.9) 28539 (20.4) 1753 (22.5) 9821 (20.3)
(65,75] 15326 ( 19.8) 32038 (22.9) 1762 (22.6) 11480 (23.7)
(75,85] 10459 ( 13.5) 27642 (19.7) 1194 (15.3) 10327 (21.3)
(85,100] 3850 ( 5.0) 12570 ( 9.0) 493 ( 6.3) 5539 (11.4)
gender2 (%) Male 40185 ( 51.9) 78478 (56.0) 3557 (45.6) 24682 (50.9)
Female 37275 ( 48.1) 61490 (43.9) 4241 (54.4) 23764 (49.0)
Other/Unknown 11 ( 0.0) 57 ( 0.0) 2 ( 0.0) 10 ( 0.0)
ethnicity2 (%) Caucasian 59028 ( 76.2) 107017 (76.4) 5981 (76.7) 36662 (75.7)
African American 9154 ( 11.8) 16452 (11.7) 823 (10.6) 5300 (10.9)
Hispanic 3263 ( 4.2) 5762 ( 4.1) 447 ( 5.7) 2813 ( 5.8)
Asian 944 ( 1.2) 1841 ( 1.3) 95 ( 1.2) 653 ( 1.3)
Native American 504 ( 0.7) 1054 ( 0.8) 50 ( 0.6) 404 ( 0.8)
Other/Unknown 4578 ( 5.9) 7899 ( 5.6) 404 ( 5.2) 2624 ( 5.4)
BMI_Ranges (%) (0,18.5] 3175 ( 4.1) 6571 ( 4.7) 566 ( 7.3) 3136 ( 6.5)
(18.5,25] 20829 ( 26.9) 39341 (28.1) 2330 (29.9) 14375 (29.7)
(25,35] 36732 ( 47.4) 65137 (46.5) 3094 (39.7) 20249 (41.8)
(35,200] 13439 ( 17.3) 24199 (17.3) 1535 (19.7) 9284 (19.2)
Other/Unknown 3296 ( 4.3) 4777 ( 3.4) 275 ( 3.5) 1412 ( 2.9)
physicianSpeciality2 (%) Critical Care 14837 ( 19.2) 43581 (31.1) 2551 (32.7) 19326 (39.9)
Speciality-Other 62634 ( 80.8) 96444 (68.9) 5249 (67.3) 29130 (60.1)
icu_admit_source2 (%) Floor 9714 ( 12.5) 22715 (16.2) 1941 (24.9) 12064 (24.9)
OR/Proc Area 15485 ( 20.0) 34452 (24.6) 389 ( 5.0) 2605 ( 5.4)
Direct Admit 9236 ( 11.9) 15045 (10.7) 492 ( 6.3) 4698 ( 9.7)
Emergency Department 41469 ( 53.5) 63623 (45.4) 4696 (60.2) 26886 (55.5)
Other 486 ( 0.6) 1236 ( 0.9) 84 ( 1.1) 554 ( 1.1)
Step-Down Unit 1081 ( 1.4) 2954 ( 2.1) 198 ( 2.5) 1649 ( 3.4)
icu_disch_location2 (%) Floor 56350 ( 72.7) 103090 (73.6) 6344 (81.3) 33635 (69.4)
Death 572 ( 0.7) 10291 ( 7.3) 258 ( 3.3) 7234 (14.9)
Home 14248 ( 18.4) 10635 ( 7.6) 453 ( 5.8) 1347 ( 2.8)
SNF/Rehab 557 ( 0.7) 2091 ( 1.5) 126 ( 1.6) 1484 ( 3.1)
Other 1944 ( 2.5) 4628 ( 3.3) 259 ( 3.3) 1974 ( 4.1)
Other Hospital 1459 ( 1.9) 3198 ( 2.3) 170 ( 2.2) 1329 ( 2.7)
Step-Down Unit 2341 ( 3.0) 6092 ( 4.4) 190 ( 2.4) 1453 ( 3.0)
hospitaldischargeyear (%) -2010 9187 ( 11.9) 17260 (12.3) 794 (10.2) 6107 (12.6)
2011 9895 ( 12.8) 18801 (13.4) 1004 (12.9) 7114 (14.7)
2012 12512 ( 16.2) 23195 (16.6) 1199 (15.4) 7904 (16.3)
2013 14808 ( 19.1) 25305 (18.1) 1453 (18.6) 8696 (17.9)
2014 15818 ( 20.4) 27145 (19.4) 1636 (21.0) 8952 (18.5)
2015-16 15251 ( 19.7) 28319 (20.2) 1714 (22.0) 9683 (20.0)
dischargelocation (mean (sd)) 5.23 (1.68) 5.31 (1.89) 4.89 (1.64) 5.46 (2.06)
dialysis (%) 0 74624 ( 96.3) 135922 (97.1) 7395 (94.8) 46553 (96.1)
1 2847 ( 3.7) 4103 ( 2.9) 405 ( 5.2) 1903 ( 3.9)
aids (%) 0 77438 (100.0) 139953 (99.9) 7775 (99.7) 48323 (99.7)
1 33 ( 0.0) 72 ( 0.1) 25 ( 0.3) 133 ( 0.3)
hepaticfailure (%) FALSE 76815 ( 99.2) 136430 (97.4) 7727 (99.1) 47099 (97.2)
TRUE 656 ( 0.8) 3595 ( 2.6) 73 ( 0.9) 1357 ( 2.8)
diabetes (%) 0 61213 ( 79.0) 108755 (77.7) 6161 (79.0) 37791 (78.0)
1 16258 ( 21.0) 31270 (22.3) 1639 (21.0) 10665 (22.0)
immunosuppression (%) 0 76228 ( 98.4) 137119 (97.9) 7500 (96.2) 46539 (96.0)
1 1243 ( 1.6) 2906 ( 2.1) 300 ( 3.8) 1917 ( 4.0)
leukemia (%) 0 77222 ( 99.7) 139084 (99.3) 7746 (99.3) 47762 (98.6)
1 249 ( 0.3) 941 ( 0.7) 54 ( 0.7) 694 ( 1.4)
lymphoma (%) 0 77301 ( 99.8) 139509 (99.6) 7770 (99.6) 48142 (99.4)
1 170 ( 0.2) 516 ( 0.4) 30 ( 0.4) 314 ( 0.6)
metastaticcancer (%) 0 76182 ( 98.3) 137370 (98.1) 7638 (97.9) 47256 (97.5)
1 1289 ( 1.7) 2655 ( 1.9) 162 ( 2.1) 1200 ( 2.5)
thrombolytics (%) 0 74789 ( 96.5) 137835 (98.4) 7793 (99.9) 48367 (99.8)
1 2682 ( 3.5) 2190 ( 1.6) 7 ( 0.1) 89 ( 0.2)
sofa_respiration_baseline2 (%) FALSE 61018 ( 78.8) 109807 (78.4) 4142 (53.1) 33041 (68.2)
TRUE 16453 ( 21.2) 30218 (21.6) 3658 (46.9) 15415 (31.8)
sofa_liver_baseline2 (%) FALSE 76815 ( 99.2) 136430 (97.4) 7727 (99.1) 47099 (97.2)
TRUE 656 ( 0.8) 3595 ( 2.6) 73 ( 0.9) 1357 ( 2.8)
sofa_renal_baseline2 (%) FALSE 74624 ( 96.3) 135922 (97.1) 7395 (94.8) 46553 (96.1)
TRUE 2847 ( 3.7) 4103 ( 2.9) 405 ( 5.2) 1903 ( 3.9)
cardiovascular_baseline (%) 0 63736 ( 82.3) 105576 (75.4) 6152 (78.9) 36397 (75.1)
1 13735 ( 17.7) 34449 (24.6) 1648 (21.1) 12059 (24.9)
group (%) Cardiovascular 30306 ( 39.1) 51979 (37.1) 817 (10.5) 5261 (10.9)
Gastrointestinal 7801 ( 10.1) 17227 (12.3) 407 ( 5.2) 3109 ( 6.4)
Gynaecological 261 ( 0.3) 421 ( 0.3) 5 ( 0.1) 28 ( 0.1)
Hematological 455 ( 0.6) 1324 ( 0.9) 33 ( 0.4) 274 ( 0.6)
Metabolic 8310 ( 10.7) 12302 ( 8.8) 274 ( 3.5) 1575 ( 3.3)
Muscoskeletal/Skin disease 1086 ( 1.4) 1693 ( 1.2) 127 ( 1.6) 552 ( 1.1)
Neurological 12518 ( 16.2) 21530 (15.4) 292 ( 3.7) 2497 ( 5.2)
Renal/Genitourinary 886 ( 1.1) 4203 ( 3.0) 109 ( 1.4) 1378 ( 2.8)
Respiratory 9883 ( 12.8) 17070 (12.2) 2882 (36.9) 11023 (22.7)
Sepsis 787 ( 1.0) 3463 ( 2.5) 2783 (35.7) 22304 (46.0)
Trauma 4145 ( 5.4) 7666 ( 5.5) 31 ( 0.4) 283 ( 0.6)
Undefined 1033 ( 1.3) 1147 ( 0.8) 40 ( 0.5) 172 ( 0.4)
library(tidyr)

ssd_incl_te%>%group_by(hospitaldischargeyear,SOFA2TruthSepsis) %>%summarise(n=n())%>%spread(SOFA2TruthSepsis,n)%>%mutate(SENS=TRUE.TRUE/(TRUE.TRUE+FALSE.TRUE),SPEC=FALSE.FALSE/(FALSE.FALSE+TRUE.FALSE))%>%knitr::kable()
hospitaldischargeyear FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE SENS SPEC
-2010 9187 17260 794 6107 0.8849442 0.3473740
2011 9895 18801 1004 7114 0.8763242 0.3448216
2012 12512 23195 1199 7904 0.8682852 0.3504075
2013 14808 25305 1453 8696 0.8568332 0.3691571
2014 15818 27145 1636 8952 0.8454855 0.3681773
2015-16 15251 28319 1714 9683 0.8496095 0.3500344
ssd_incl_te%>%group_by(age_Ranges,SOFA2TruthSepsis) %>%summarise(n=n())%>%spread(SOFA2TruthSepsis,n)%>%mutate(SENS=TRUE.TRUE/(TRUE.TRUE+FALSE.TRUE),SPEC=FALSE.FALSE/(FALSE.FALSE+TRUE.FALSE))%>%knitr::kable()
age_Ranges FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE SENS SPEC
(0,25] 3772 4192 262 825 0.7589696 0.4736313
(25,35] 5346 6533 501 1680 0.7702889 0.4500379
(35,45] 7772 9280 609 2667 0.8141026 0.4557823
(45,55] 13955 19231 1226 6117 0.8330383 0.4205086
(55,65] 16991 28539 1753 9821 0.8485398 0.3731825
(65,75] 15326 32038 1762 11480 0.8669385 0.3235791
(75,85] 10459 27642 1194 10327 0.8963632 0.2745072
(85,100] 3850 12570 493 5539 0.9182692 0.2344702
ssd_incl_te%>%group_by(BMI_Ranges,SOFA2TruthSepsis) %>%summarise(n=n())%>%spread(SOFA2TruthSepsis,n)%>%mutate(SENS=TRUE.TRUE/(TRUE.TRUE+FALSE.TRUE),SPEC=FALSE.FALSE/(FALSE.FALSE+TRUE.FALSE))%>%knitr::kable()
BMI_Ranges FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE SENS SPEC
(0,18.5] 3175 6571 566 3136 0.8471097 0.3257747
(18.5,25] 20829 39341 2330 14375 0.8605208 0.3461692
(25,35] 36732 65137 3094 20249 0.8674549 0.3605807
(35,200] 13439 24199 1535 9284 0.8581200 0.3570594
Other/Unknown 3296 4777 275 1412 0.8369887 0.4082745
ssd_incl_te%>%group_by(icu_admit_source2,SOFA2TruthSepsis) %>%summarise(n=n())%>%spread(SOFA2TruthSepsis,n)%>%mutate(SENS=TRUE.TRUE/(TRUE.TRUE+FALSE.TRUE),SPEC=FALSE.FALSE/(FALSE.FALSE+TRUE.FALSE))%>%knitr::kable()
icu_admit_source2 FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE SENS SPEC
Floor 9714 22715 1941 12064 0.8614066 0.2995467
OR/Proc Area 15485 34452 389 2605 0.8700735 0.3100907
Direct Admit 9236 15045 492 4698 0.9052023 0.3803797
Emergency Department 41469 63623 4696 26886 0.8513077 0.3945971
Other 486 1236 84 554 0.8683386 0.2822300
Step-Down Unit 1081 2954 198 1649 0.8927991 0.2679058
ssd_incl_te%>%group_by(ethnicity2,SOFA2TruthSepsis) %>%summarise(n=n())%>%spread(SOFA2TruthSepsis,n)%>%mutate(SENS=TRUE.TRUE/(TRUE.TRUE+FALSE.TRUE),SPEC=FALSE.FALSE/(FALSE.FALSE+TRUE.FALSE))%>%knitr::kable()
ethnicity2 FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE SENS SPEC
Caucasian 59028 107017 5981 36662 0.8597425 0.3554940
African American 9154 16452 823 5300 0.8655888 0.3574943
Hispanic 3263 5762 447 2813 0.8628834 0.3615512
Asian 944 1841 95 653 0.8729947 0.3389587
Native American 504 1054 50 404 0.8898678 0.3234917
Other/Unknown 4578 7899 404 2624 0.8665786 0.3669151
ssd_incl_te%>%group_by(physicianSpeciality2,SOFA2TruthSepsis) %>%summarise(n=n())%>%spread(SOFA2TruthSepsis,n)%>%mutate(SENS=TRUE.TRUE/(TRUE.TRUE+FALSE.TRUE),SPEC=FALSE.FALSE/(FALSE.FALSE+TRUE.FALSE))%>%knitr::kable()
physicianSpeciality2 FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE SENS SPEC
Critical Care 14837 43581 2551 19326 0.8833935 0.2539799
Speciality-Other 62634 96444 5249 29130 0.8473196 0.3937314
vars5 <- c("age_Ranges", "gender2", "ethnicity2", "BMI_Ranges", "physicianSpeciality2", "icu_admit_source2", "icu_disch_location2", "hospitaldischargeyear", "dischargelocation", "dialysis", "aids", "hepaticfailure",  "diabetes",  "immunosuppression" , "leukemia", "lymphoma", "metastaticcancer", "thrombolytics", "sofa_respiration_baseline2", "sofa_liver_baseline2", "sofa_renal_baseline2", "cardiovascular_baseline", "group" )

library(dplyr); library(Hmisc); library(ggplot2); #library(sjPlot)

if(!("tableone" %in% rownames(installed.packages()))) {
  install.packages("tableone")
}
library(dplyr); library(Hmisc); library(ggplot2); #library(sjPlot)
library(tableone)

CreateTableOne(data=ssd_incl_te ,vars=vars5,strata="FuzzyLogicTruthSepsis",test=FALSE, includeNA=TRUE
) %>% print(nonnormal= c("sofa_respiration_baseline", "sofa_liver_baseline", "sofa_renal_baseline"),minMax=TRUE,
  printToggle      = FALSE,
  showAllLevels    = TRUE,
  cramVars         = "kon"
) %>%
{data.frame(
  variable_name             = gsub(" ", "&nbsp;", rownames(.), fixed = TRUE), .,                                                                                                                     
  row.names        = NULL,
  check.names      = FALSE,
  stringsAsFactors = FALSE)} %>%
  knitr::kable(caption="FuzzyLogic positive negative sepsis outcome")
FuzzyLogic positive negative sepsis outcome
variable_name level FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE
n 112558 104938 10372 45884
age_Ranges (%) (0,25] 3831 ( 3.4) 4133 ( 3.9) 192 ( 1.9) 895 ( 2.0)
(25,35] 6258 ( 5.6) 5621 ( 5.4) 407 ( 3.9) 1774 ( 3.9)
(35,45] 9317 ( 8.3) 7735 ( 7.4) 622 ( 6.0) 2654 ( 5.8)
(45,55] 17833 (15.8) 15353 ( 14.6) 1381 (13.3) 5962 (13.0)
(55,65] 23682 (21.0) 21848 ( 20.8) 2171 (20.9) 9403 (20.5)
(65,75] 24038 (21.4) 23326 ( 22.2) 2475 (23.9) 10767 (23.5)
(75,85] 19205 (17.1) 18896 ( 18.0) 2085 (20.1) 9436 (20.6)
(85,100] 8394 ( 7.5) 8026 ( 7.6) 1039 (10.0) 4993 (10.9)
gender2 (%) Male 62445 (55.5) 56218 ( 53.6) 5331 (51.4) 22908 (49.9)
Female 50090 (44.5) 48675 ( 46.4) 5038 (48.6) 22967 (50.1)
Other/Unknown 23 ( 0.0) 45 ( 0.0) 3 ( 0.0) 9 ( 0.0)
ethnicity2 (%) Caucasian 84661 (75.2) 81384 ( 77.6) 7718 (74.4) 34925 (76.1)
African American 14257 (12.7) 11349 ( 10.8) 1321 (12.7) 4802 (10.5)
Hispanic 4791 ( 4.3) 4234 ( 4.0) 608 ( 5.9) 2652 ( 5.8)
Asian 1526 ( 1.4) 1259 ( 1.2) 117 ( 1.1) 631 ( 1.4)
Native American 805 ( 0.7) 753 ( 0.7) 79 ( 0.8) 375 ( 0.8)
Other/Unknown 6518 ( 5.8) 5959 ( 5.7) 529 ( 5.1) 2499 ( 5.4)
BMI_Ranges (%) (0,18.5] 4542 ( 4.0) 5204 ( 5.0) 593 ( 5.7) 3109 ( 6.8)
(18.5,25] 30572 (27.2) 29598 ( 28.2) 2894 (27.9) 13811 (30.1)
(25,35] 53815 (47.8) 48054 ( 45.8) 4301 (41.5) 19042 (41.5)
(35,200] 18893 (16.8) 18745 ( 17.9) 2195 (21.2) 8624 (18.8)
Other/Unknown 4736 ( 4.2) 3337 ( 3.2) 389 ( 3.8) 1298 ( 2.8)
physicianSpeciality2 (%) Critical Care 23765 (21.1) 34653 ( 33.0) 3459 (33.3) 18418 (40.1)
Speciality-Other 88793 (78.9) 70285 ( 67.0) 6913 (66.7) 27466 (59.9)
icu_admit_source2 (%) Floor 15639 (13.9) 16790 ( 16.0) 2919 (28.1) 11086 (24.2)
OR/Proc Area 22390 (19.9) 27547 ( 26.3) 589 ( 5.7) 2405 ( 5.2)
Direct Admit 14914 (13.3) 9367 ( 8.9) 1063 (10.2) 4127 ( 9.0)
Emergency Department 56909 (50.6) 48183 ( 45.9) 5225 (50.4) 26357 (57.4)
Other 862 ( 0.8) 860 ( 0.8) 156 ( 1.5) 482 ( 1.1)
Step-Down Unit 1844 ( 1.6) 2191 ( 2.1) 420 ( 4.0) 1427 ( 3.1)
icu_disch_location2 (%) Floor 82010 (72.9) 77430 ( 73.8) 8231 (79.4) 31748 (69.2)
Death 1594 ( 1.4) 9269 ( 8.8) 389 ( 3.8) 7103 (15.5)
Home 18696 (16.6) 6187 ( 5.9) 536 ( 5.2) 1264 ( 2.8)
SNF/Rehab 1207 ( 1.1) 1441 ( 1.4) 269 ( 2.6) 1341 ( 2.9)
Other 3233 ( 2.9) 3339 ( 3.2) 361 ( 3.5) 1872 ( 4.1)
Other Hospital 2217 ( 2.0) 2440 ( 2.3) 249 ( 2.4) 1250 ( 2.7)
Step-Down Unit 3601 ( 3.2) 4832 ( 4.6) 337 ( 3.2) 1306 ( 2.8)
hospitaldischargeyear (%) -2010 13636 (12.1) 12811 ( 12.2) 1155 (11.1) 5746 (12.5)
2011 14634 (13.0) 14062 ( 13.4) 1365 (13.2) 6753 (14.7)
2012 18350 (16.3) 17357 ( 16.5) 1581 (15.2) 7522 (16.4)
2013 20936 (18.6) 19177 ( 18.3) 1906 (18.4) 8243 (18.0)
2014 22558 (20.0) 20405 ( 19.4) 2090 (20.2) 8498 (18.5)
2015-16 22444 (19.9) 21126 ( 20.1) 2275 (21.9) 9122 (19.9)
dischargelocation (mean (sd)) 5.22 (1.70) 5.34 (1.93) 4.99 (1.70) 5.47 (2.07)
dialysis (%) 0 108683 (96.6) 101863 ( 97.1) 9843 (94.9) 44105 (96.1)
1 3875 ( 3.4) 3075 ( 2.9) 529 ( 5.1) 1779 ( 3.9)
aids (%) 0 112497 (99.9) 104894 (100.0) 10332 (99.6) 45766 (99.7)
1 61 ( 0.1) 44 ( 0.0) 40 ( 0.4) 118 ( 0.3)
hepaticfailure (%) FALSE 111225 (98.8) 102020 ( 97.2) 10184 (98.2) 44642 (97.3)
TRUE 1333 ( 1.2) 2918 ( 2.8) 188 ( 1.8) 1242 ( 2.7)
diabetes (%) 0 85076 (75.6) 84892 ( 80.9) 7122 (68.7) 36830 (80.3)
1 27482 (24.4) 20046 ( 19.1) 3250 (31.3) 9054 (19.7)
immunosuppression (%) 0 110806 (98.4) 102541 ( 97.7) 9998 (96.4) 44041 (96.0)
1 1752 ( 1.6) 2397 ( 2.3) 374 ( 3.6) 1843 ( 4.0)
leukemia (%) 0 112074 (99.6) 104232 ( 99.3) 10244 (98.8) 45264 (98.6)
1 484 ( 0.4) 706 ( 0.7) 128 ( 1.2) 620 ( 1.4)
lymphoma (%) 0 112246 (99.7) 104564 ( 99.6) 10321 (99.5) 45591 (99.4)
1 312 ( 0.3) 374 ( 0.4) 51 ( 0.5) 293 ( 0.6)
metastaticcancer (%) 0 110816 (98.5) 102736 ( 97.9) 10162 (98.0) 44732 (97.5)
1 1742 ( 1.5) 2202 ( 2.1) 210 ( 2.0) 1152 ( 2.5)
thrombolytics (%) 0 109282 (97.1) 103342 ( 98.5) 10356 (99.8) 45804 (99.8)
1 3276 ( 2.9) 1596 ( 1.5) 16 ( 0.2) 80 ( 0.2)
sofa_respiration_baseline2 (%) FALSE 91478 (81.3) 79347 ( 75.6) 6619 (63.8) 30564 (66.6)
TRUE 21080 (18.7) 25591 ( 24.4) 3753 (36.2) 15320 (33.4)
sofa_liver_baseline2 (%) FALSE 111225 (98.8) 102020 ( 97.2) 10184 (98.2) 44642 (97.3)
TRUE 1333 ( 1.2) 2918 ( 2.8) 188 ( 1.8) 1242 ( 2.7)
sofa_renal_baseline2 (%) FALSE 108683 (96.6) 101863 ( 97.1) 9843 (94.9) 44105 (96.1)
TRUE 3875 ( 3.4) 3075 ( 2.9) 529 ( 5.1) 1779 ( 3.9)
cardiovascular_baseline (%) 0 88247 (78.4) 81065 ( 77.3) 7585 (73.1) 34964 (76.2)
1 24311 (21.6) 23873 ( 22.7) 2787 (26.9) 10920 (23.8)
group (%) Cardiovascular 45657 (40.6) 36628 ( 34.9) 1376 (13.3) 4702 (10.2)
Gastrointestinal 10269 ( 9.1) 14759 ( 14.1) 576 ( 5.6) 2940 ( 6.4)
Gynaecological 241 ( 0.2) 441 ( 0.4) 7 ( 0.1) 26 ( 0.1)
Hematological 810 ( 0.7) 969 ( 0.9) 64 ( 0.6) 243 ( 0.5)
Metabolic 10717 ( 9.5) 9895 ( 9.4) 429 ( 4.1) 1420 ( 3.1)
Muscoskeletal/Skin disease 1404 ( 1.2) 1375 ( 1.3) 150 ( 1.4) 529 ( 1.2)
Neurological 22038 (19.6) 12010 ( 11.4) 796 ( 7.7) 1993 ( 4.3)
Renal/Genitourinary 2428 ( 2.2) 2661 ( 2.5) 363 ( 3.5) 1124 ( 2.4)
Respiratory 11009 ( 9.8) 15944 ( 15.2) 3127 (30.1) 10778 (23.5)
Sepsis 949 ( 0.8) 3301 ( 3.1) 3370 (32.5) 21717 (47.3)
Trauma 5862 ( 5.2) 5949 ( 5.7) 63 ( 0.6) 251 ( 0.5)
Undefined 1174 ( 1.0) 1006 ( 1.0) 51 ( 0.5) 161 ( 0.4)
library(tidyr)
ssd_incl_te%>%group_by(hospitaldischargeyear,FuzzyLogicTruthSepsis) %>%summarise(n=n())%>%spread(FuzzyLogicTruthSepsis,n)%>%mutate(SENS=TRUE.TRUE/(TRUE.TRUE+FALSE.TRUE),SPEC=FALSE.FALSE/(FALSE.FALSE+TRUE.FALSE))%>%knitr::kable()
hospitaldischargeyear FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE SENS SPEC
-2010 13636 12811 1155 5746 0.8326330 0.5155972
2011 14634 14062 1365 6753 0.8318551 0.5099665
2012 18350 17357 1581 7522 0.8263210 0.5139048
2013 20936 19177 1906 8243 0.8121982 0.5219256
2014 22558 20405 2090 8498 0.8026067 0.5250564
2015-16 22444 21126 2275 9122 0.8003861 0.5151251
ssd_incl_te%>%group_by(age_Ranges,FuzzyLogicTruthSepsis) %>%summarise(n=n())%>%spread(FuzzyLogicTruthSepsis,n)%>%mutate(SENS=TRUE.TRUE/(TRUE.TRUE+FALSE.TRUE),SPEC=FALSE.FALSE/(FALSE.FALSE+TRUE.FALSE))%>%knitr::kable()
age_Ranges FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE SENS SPEC
(0,25] 3831 4133 192 895 0.8233671 0.4810397
(25,35] 6258 5621 407 1774 0.8133884 0.5268120
(35,45] 9317 7735 622 2654 0.8101343 0.5463875
(45,55] 17833 15353 1381 5962 0.8119297 0.5373652
(55,65] 23682 21848 2171 9403 0.8124244 0.5201406
(65,75] 24038 23326 2475 10767 0.8130947 0.5075163
(75,85] 19205 18896 2085 9436 0.8190261 0.5040550
(85,100] 8394 8026 1039 4993 0.8277520 0.5112058
ssd_incl_te%>%group_by(BMI_Ranges,FuzzyLogicTruthSepsis) %>%summarise(n=n())%>%spread(FuzzyLogicTruthSepsis,n)%>%mutate(SENS=TRUE.TRUE/(TRUE.TRUE+FALSE.TRUE),SPEC=FALSE.FALSE/(FALSE.FALSE+TRUE.FALSE))%>%knitr::kable()
BMI_Ranges FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE SENS SPEC
(0,18.5] 4542 5204 593 3109 0.8398163 0.4660373
(18.5,25] 30572 29598 2894 13811 0.8267585 0.5080937
(25,35] 53815 48054 4301 19042 0.8157478 0.5282765
(35,200] 18893 18745 2195 8624 0.7971162 0.5019661
Other/Unknown 4736 3337 389 1298 0.7694132 0.5866468
ssd_incl_te%>%group_by(icu_admit_source2,FuzzyLogicTruthSepsis) %>%summarise(n=n())%>%spread(FuzzyLogicTruthSepsis,n)%>%mutate(SENS=TRUE.TRUE/(TRUE.TRUE+FALSE.TRUE),SPEC=FALSE.FALSE/(FALSE.FALSE+TRUE.FALSE))%>%knitr::kable()
icu_admit_source2 FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE SENS SPEC
Floor 15639 16790 2919 11086 0.7915744 0.4822535
OR/Proc Area 22390 27547 589 2405 0.8032732 0.4483649
Direct Admit 14914 9367 1063 4127 0.7951830 0.6142251
Emergency Department 56909 48183 5225 26357 0.8345577 0.5415160
Other 862 860 156 482 0.7554859 0.5005807
Step-Down Unit 1844 2191 420 1427 0.7726042 0.4570012
ssd_incl_te%>%group_by(ethnicity2,FuzzyLogicTruthSepsis) %>%summarise(n=n())%>%spread(FuzzyLogicTruthSepsis,n)%>%mutate(SENS=TRUE.TRUE/(TRUE.TRUE+FALSE.TRUE),SPEC=FALSE.FALSE/(FALSE.FALSE+TRUE.FALSE))%>%knitr::kable()
ethnicity2 FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE SENS SPEC
Caucasian 84661 81384 7718 34925 0.8190090 0.5098678
African American 14257 11349 1321 4802 0.7842561 0.5567836
Hispanic 4791 4234 608 2652 0.8134969 0.5308587
Asian 1526 1259 117 631 0.8435829 0.5479354
Native American 805 753 79 375 0.8259912 0.5166881
Other/Unknown 6518 5959 529 2499 0.8252972 0.5224012
ssd_incl_te%>%group_by(physicianSpeciality2,FuzzyLogicTruthSepsis) %>%summarise(n=n())%>%spread(FuzzyLogicTruthSepsis,n)%>%mutate(SENS=TRUE.TRUE/(TRUE.TRUE+FALSE.TRUE),SPEC=FALSE.FALSE/(FALSE.FALSE+TRUE.FALSE))%>%knitr::kable()
physicianSpeciality2 FALSE.FALSE TRUE.FALSE FALSE.TRUE TRUE.TRUE SENS SPEC
Critical Care 23765 34653 3459 18418 0.8418887 0.4068095
Speciality-Other 88793 70285 6913 27466 0.7989179 0.5581727

24 Table 1 Before inclusion/exclusion

varsTable1 <- c("age", "gender2", "ethnicity2", "BMI_Ranges", "icu_admit_source2","physicianSpeciality2",  "hospitaldischargeyear", "hospital_teaching_status", "hospital_size", "hospital_region2","dialysis", "aids", "hepaticfailure", "diabetes", "immunosuppression", "leukemia", "lymphoma", "metastaticcancer", "thrombolytics", "sofa_respiration_baseline2", "cardiovascular_baseline","SIRS_Positive", "qSOFA_Positive", "SOFA_Positive", "SepsisFuzzyLogicPositive","apacheiva", "hospital_mortality_ultimate", "icu_mortality", "hospital_los", "icu_los","sepsis_outcome", "group")

library(dplyr); library(Hmisc); library(ggplot2); library(sjPlot)

if(!("tableone" %in% rownames(installed.packages()))) {
  install.packages("tableone")
}

library(tableone)

CreateTableOne(data=ssd ,vars=varsTable1,strata="hospital_mortality_ultimate",test=TRUE, includeNA=TRUE
) %>% print(nonnormal= c("icu_mortality", "sepsis_outcome","hospital_teaching_status"),minMax=TRUE,
  printToggle      = FALSE,
  showAllLevels    = TRUE,
  cramVars         = "kon"
) %>%
{data.frame(
  variable_name             = gsub(" ", "&nbsp;", rownames(.), fixed = TRUE), .,                                                                                                                     
  row.names        = NULL,
  check.names      = FALSE,
  stringsAsFactors = FALSE)} %>%
  knitr::kable(caption= "Demographic, Severity of Illness, Diagnostic, and Outcome Data")
Demographic, Severity of Illness, Diagnostic, and Outcome Data
variable_name level 0 1 p test
n 2200750 236690
age (mean (sd)) 61.97 (17.51) 69.72 (15.00) <0.001
gender2 (%) Male 1185691 ( 53.9) 125568 ( 53.1) <0.001
Female 1011585 ( 46.0) 110708 ( 46.8)
Other/Unknown 3474 ( 0.2) 414 ( 0.2)
ethnicity2 (%) Caucasian 1662178 ( 75.5) 179335 ( 75.8) <0.001
African American 241932 ( 11.0) 25446 ( 10.8)
Hispanic 109661 ( 5.0) 11284 ( 4.8)
Asian 34728 ( 1.6) 4497 ( 1.9)
Native American 17674 ( 0.8) 1689 ( 0.7)
Other/Unknown 134577 ( 6.1) 14439 ( 6.1)
BMI_Ranges (%) (0,18.5] 99308 ( 4.5) 17010 ( 7.2) <0.001
(18.5,25] 607267 ( 27.6) 74018 ( 31.3)
(25,35] 981253 ( 44.6) 90336 ( 38.2)
(35,200] 371204 ( 16.9) 33388 ( 14.1)
Other/Unknown 141718 ( 6.4) 21938 ( 9.3)
icu_admit_source2 (%) Floor 353263 ( 16.1) 68254 ( 28.8) <0.001
OR/Proc Area 451553 ( 20.5) 19077 ( 8.1)
Direct Admit 209313 ( 9.5) 23747 ( 10.0)
Emergency Department 1078676 ( 49.0) 108740 ( 45.9)
Other 63717 ( 2.9) 8765 ( 3.7)
Step-Down Unit 44228 ( 2.0) 8107 ( 3.4)
physicianSpeciality2 (%) Critical Care 411995 ( 18.7) 61205 ( 25.9) <0.001
Speciality-Other 1788755 ( 81.3) 175485 ( 74.1)
hospitaldischargeyear (%) -2010 752801 ( 34.2) 83469 ( 35.3) <0.001
2011 227837 ( 10.4) 24579 ( 10.4)
2012 260187 ( 11.8) 27611 ( 11.7)
2013 277559 ( 12.6) 29612 ( 12.5)
2014 294619 ( 13.4) 30288 ( 12.8)
2015-16 387747 ( 17.6) 41131 ( 17.4)
hospital_teaching_status (%) 439931 ( 20.0) 41136 ( 17.4) <0.001
f 1304606 ( 59.3) 138608 ( 58.6)
t 456213 ( 20.7) 56946 ( 24.1)
hospital_size (%) 509771 ( 23.2) 48616 ( 20.5) <0.001
<100 111324 ( 5.1) 8921 ( 3.8)
100-249 431572 ( 19.6) 40995 ( 17.3)
250-500 376455 ( 17.1) 41401 ( 17.5)
>500 771628 ( 35.1) 96757 ( 40.9)
hospital_region2 (%) Midwest 622551 ( 28.3) 64551 ( 27.3) <0.001
Northeast 124015 ( 5.6) 17161 ( 7.3)
South 565828 ( 25.7) 69791 ( 29.5)
West 395017 ( 17.9) 38840 ( 16.4)
Unknown 493339 ( 22.4) 46347 ( 19.6)
dialysis (%) 0 2124367 ( 96.5) 224664 ( 94.9) NaN
1 76383 ( 3.5) 12026 ( 5.1)
NA 0 ( 0.0) 0 ( 0.0)
aids (%) 0 2198348 ( 99.9) 236188 ( 99.8) NaN
1 2402 ( 0.1) 502 ( 0.2)
NA 0 ( 0.0) 0 ( 0.0)
hepaticfailure (%) FALSE 2159154 ( 98.1) 228258 ( 96.4) NaN
TRUE 41596 ( 1.9) 8432 ( 3.6)
NA 0 ( 0.0) 0 ( 0.0)
diabetes (%) 0 1724302 ( 78.4) 191474 ( 80.9) NaN
1 476448 ( 21.6) 45216 ( 19.1)
NA 0 ( 0.0) 0 ( 0.0)
immunosuppression (%) 0 2155928 ( 98.0) 226667 ( 95.8) NaN
1 44822 ( 2.0) 10023 ( 4.2)
NA 0 ( 0.0) 0 ( 0.0)
leukemia (%) 0 2187388 ( 99.4) 233115 ( 98.5) NaN
1 13362 ( 0.6) 3575 ( 1.5)
NA 0 ( 0.0) 0 ( 0.0)
lymphoma (%) 0 2192810 ( 99.6) 235019 ( 99.3) NaN
1 7940 ( 0.4) 1671 ( 0.7)
NA 0 ( 0.0) 0 ( 0.0)
metastaticcancer (%) 0 2164132 ( 98.3) 227609 ( 96.2) NaN
1 36618 ( 1.7) 9081 ( 3.8)
NA 0 ( 0.0) 0 ( 0.0)
thrombolytics (%) 0 2163227 ( 98.3) 233398 ( 98.6) NaN
1 37523 ( 1.7) 3292 ( 1.4)
NA 0 ( 0.0) 0 ( 0.0)
sofa_respiration_baseline2 (%) FALSE 1725862 ( 78.4) 174443 ( 73.7) <0.001
TRUE 474888 ( 21.6) 62247 ( 26.3)
cardiovascular_baseline (%) 0 1743486 ( 79.2) 174973 ( 73.9) <0.001
1 457264 ( 20.8) 61717 ( 26.1)
SIRS_Positive (%) FALSE 662262 ( 30.1) 29711 ( 12.6) <0.001
TRUE 1538488 ( 69.9) 206979 ( 87.4)
qSOFA_Positive (%) FALSE 905481 ( 41.1) 42305 ( 17.9) <0.001
TRUE 1295269 ( 58.9) 194385 ( 82.1)
SOFA_Positive (%) FALSE 833502 ( 37.9) 24965 ( 10.5) <0.001
TRUE 1367248 ( 62.1) 211725 ( 89.5)
SepsisFuzzyLogicPositive (%) FALSE 1156340 ( 52.5) 49013 ( 20.7) <0.001
TRUE 1044410 ( 47.5) 187677 ( 79.3)
apacheiva (mean (sd)) 49.53 (23.88) 82.85 (35.21) <0.001
hospital_mortality_ultimate (%) 0 2200750 (100.0) 0 ( 0.0) NaN
1 0 ( 0.0) 236690 (100.0)
NA 0 ( 0.0) 0 ( 0.0)
icu_mortality (%) 0 2197818 ( 99.9) 97253 ( 41.1) <0.001
1 2560 ( 0.1) 139399 ( 58.9)
NA 372 ( 0.0) 38 ( 0.0)
hospital_los (mean (sd)) 8.70 (51.35) 10.40 (100.12) <0.001
icu_los (mean (sd)) 2.84 (4.10) 4.27 (6.37) <0.001
sepsis_outcome (%) FALSE 1654616 ( 75.2) 127568 ( 53.9) <0.001
TRUE 371469 ( 16.9) 83856 ( 35.4)
NA 174665 ( 7.9) 25266 ( 10.7)
group (%) Cardiovascular 717129 ( 32.6) 66498 ( 28.1) <0.001
Gastrointestinal 227007 ( 10.3) 21653 ( 9.1)
Gynaecological 6498 ( 0.3) 100 ( 0.0)
Hematological 15625 ( 0.7) 1911 ( 0.8)
Metabolic 181200 ( 8.2) 3691 ( 1.6)
Muscoskeletal/Skin disease 32042 ( 1.5) 1584 ( 0.7)
Neurological 275981 ( 12.5) 27757 ( 11.7)
Renal/Genitourinary 54223 ( 2.5) 4372 ( 1.8)
Respiratory 307334 ( 14.0) 47033 ( 19.9)
Sepsis 260337 ( 11.8) 52266 ( 22.1)
Trauma 98345 ( 4.5) 7363 ( 3.1)
Undefined 17322 ( 0.8) 2275 ( 1.0)
NA 7707 ( 0.4) 187 ( 0.1)
CreateTableOne(data=ssd ,vars=varsTable1,strata="sepsis_outcome",test=TRUE, includeNA=TRUE
) %>% print(nonnormal= c("hospital_mortality_ultimate", "icu_mortality", "hospital_teaching_status"),minMax=TRUE,
  printToggle      = FALSE,
  showAllLevels    = TRUE,
  cramVars         = "kon"
) %>%
{data.frame(
  variable_name             = gsub(" ", "&nbsp;", rownames(.), fixed = TRUE), .,                                                                                                                     
  row.names        = NULL,
  check.names      = FALSE,
  stringsAsFactors = FALSE)} %>%
  knitr::kable(caption= "Demographic, Severity of Illness, Diagnostic, and Outcome Data")
Demographic, Severity of Illness, Diagnostic, and Outcome Data
variable_name level FALSE TRUE p test
n 1906183 485158
age (mean (sd)) 62.00 (17.62) 65.33 (16.30) <0.001
gender2 (%) Male 1041537 ( 54.6) 247071 ( 50.9) <0.001
Female 862802 ( 45.3) 237856 ( 49.0)
Other/Unknown 1844 ( 0.1) 231 ( 0.0)
ethnicity2 (%) Caucasian 1440415 ( 75.6) 362535 ( 74.7) <0.001
African American 209919 ( 11.0) 54731 ( 11.3)
Hispanic 89531 ( 4.7) 28114 ( 5.8)
Asian 30883 ( 1.6) 8136 ( 1.7)
Native American 15141 ( 0.8) 4412 ( 0.9)
Other/Unknown 120294 ( 6.3) 27230 ( 5.6)
BMI_Ranges (%) (0,18.5] 82448 ( 4.3) 32315 ( 6.7) <0.001
(18.5,25] 527106 ( 27.7) 143582 ( 29.6)
(25,35] 864803 ( 45.4) 194894 ( 40.2)
(35,200] 312118 ( 16.4) 89639 ( 18.5)
Other/Unknown 119708 ( 6.3) 24728 ( 5.1)
icu_admit_source2 (%) Floor 274569 ( 14.4) 118755 ( 24.5) <0.001
OR/Proc Area 435146 ( 22.8) 24784 ( 5.1)
Direct Admit 187226 ( 9.8) 35055 ( 7.2)
Emergency Department 881068 ( 46.2) 263433 ( 54.3)
Other 71673 ( 3.8) 22718 ( 4.7)
Step-Down Unit 56501 ( 3.0) 20413 ( 4.2)
physicianSpeciality2 (%) Critical Care 319996 ( 16.8) 120000 ( 24.7) <0.001
Speciality-Other 1586187 ( 83.2) 365158 ( 75.3)
hospitaldischargeyear (%) -2010 639409 ( 33.5) 127734 ( 26.3) <0.001
2011 201908 ( 10.6) 55907 ( 11.5)
2012 232782 ( 12.2) 63074 ( 13.0)
2013 247893 ( 13.0) 69668 ( 14.4)
2014 261515 ( 13.7) 74955 ( 15.4)
2015-16 322676 ( 16.9) 93820 ( 19.3)
hospital_teaching_status (%) 381796 ( 20.0) 81424 ( 16.8) <0.001
f 1134725 ( 59.5) 293910 ( 60.6)
t 389662 ( 20.4) 109824 ( 22.6)
hospital_size (%) 443992 ( 23.3) 95727 ( 19.7) <0.001
<100 80363 ( 4.2) 30002 ( 6.2)
100-249 366501 ( 19.2) 91993 ( 19.0)
250-500 314346 ( 16.5) 95797 ( 19.7)
>500 700981 ( 36.8) 171639 ( 35.4)
hospital_region2 (%) Midwest 527381 ( 27.7) 123262 ( 25.4) <0.001
Northeast 94132 ( 4.9) 48266 ( 9.9)
South 500396 ( 26.3) 127715 ( 26.3)
West 343530 ( 18.0) 95658 ( 19.7)
Unknown 440744 ( 23.1) 90257 ( 18.6)
dialysis (%) 0 1721090 ( 90.3) 433406 ( 89.3) <0.001
1 61094 ( 3.2) 21919 ( 4.5)
NA 123999 ( 6.5) 29833 ( 6.1)
aids (%) 0 1781020 ( 93.4) 453749 ( 93.5) <0.001
1 1164 ( 0.1) 1576 ( 0.3)
NA 123999 ( 6.5) 29833 ( 6.1)
hepaticfailure (%) FALSE 1747642 ( 91.7) 442751 ( 91.3) <0.001
TRUE 34542 ( 1.8) 12574 ( 2.6)
NA 123999 ( 6.5) 29833 ( 6.1)
diabetes (%) 0 1393143 ( 73.1) 351921 ( 72.5) <0.001
1 389041 ( 20.4) 103404 ( 21.3)
NA 123999 ( 6.5) 29833 ( 6.1)
immunosuppression (%) 0 1748852 ( 91.7) 437507 ( 90.2) <0.001
1 33332 ( 1.7) 17818 ( 3.7)
NA 123999 ( 6.5) 29833 ( 6.1)
leukemia (%) 0 1772097 ( 93.0) 449469 ( 92.6) <0.001
1 10087 ( 0.5) 5856 ( 1.2)
NA 123999 ( 6.5) 29833 ( 6.1)
lymphoma (%) 0 1776216 ( 93.2) 452286 ( 93.2) <0.001
1 5968 ( 0.3) 3039 ( 0.6)
NA 123999 ( 6.5) 29833 ( 6.1)
metastaticcancer (%) 0 1750410 ( 91.8) 444166 ( 91.6) <0.001
1 31774 ( 1.7) 11159 ( 2.3)
NA 123999 ( 6.5) 29833 ( 6.1)
thrombolytics (%) 0 1744509 ( 91.5) 454375 ( 93.7) <0.001
1 37675 ( 2.0) 950 ( 0.2)
NA 123999 ( 6.5) 29833 ( 6.1)
sofa_respiration_baseline2 (%) FALSE 1519390 ( 79.7) 324930 ( 67.0) <0.001
TRUE 386793 ( 20.3) 160228 ( 33.0)
cardiovascular_baseline (%) 0 1500867 ( 78.7) 370111 ( 76.3) <0.001
1 405316 ( 21.3) 115047 ( 23.7)
SIRS_Positive (%) FALSE 604594 ( 31.7) 67054 ( 13.8) <0.001
TRUE 1301589 ( 68.3) 418104 ( 86.2)
qSOFA_Positive (%) FALSE 824832 ( 43.3) 117284 ( 24.2) <0.001
TRUE 1081351 ( 56.7) 367874 ( 75.8)
SOFA_Positive (%) FALSE 763287 ( 40.0) 85809 ( 17.7) <0.001
TRUE 1142896 ( 60.0) 399349 ( 82.3)
SepsisFuzzyLogicPositive (%) FALSE 1064503 ( 55.8) 108422 ( 22.3) <0.001
TRUE 841680 ( 44.2) 376736 ( 77.7)
apacheiva (mean (sd)) 49.62 (24.87) 67.19 (28.91) <0.001
hospital_mortality_ultimate (%) 0 1654616 ( 86.8) 371469 ( 76.6) <0.001
1 127568 ( 6.7) 83856 ( 17.3)
NA 123999 ( 6.5) 29833 ( 6.1)
icu_mortality (%) 0 1825421 ( 95.8) 430566 ( 88.7) <0.001
1 80536 ( 4.2) 54546 ( 11.2)
NA 226 ( 0.0) 46 ( 0.0)
hospital_los (mean (sd)) 7.91 (60.18) 12.00 (35.87) <0.001
icu_los (mean (sd)) 2.66 (3.89) 4.05 (5.37) <0.001
sepsis_outcome (%) FALSE 1906183 (100.0) 0 ( 0.0) NaN
TRUE 0 ( 0.0) 485158 (100.0)
NA 0 ( 0.0) 0 ( 0.0)
group (%) Cardiovascular 731047 ( 38.4) 53266 ( 11.0) <0.001
Gastrointestinal 217852 ( 11.4) 30809 ( 6.4)
Gynaecological 6226 ( 0.3) 287 ( 0.1)
Hematological 14624 ( 0.8) 2823 ( 0.6)
Metabolic 170040 ( 8.9) 15144 ( 3.1)
Muscoskeletal/Skin disease 26906 ( 1.4) 6003 ( 1.2)
Neurological 278905 ( 14.6) 24108 ( 5.0)
Renal/Genitourinary 45496 ( 2.4) 12549 ( 2.6)
Respiratory 236310 ( 12.4) 116604 ( 24.0)
Sepsis 52258 ( 2.7) 218627 ( 45.1)
Trauma 102234 ( 5.4) 3019 ( 0.6)
Undefined 17802 ( 0.9) 1838 ( 0.4)
NA 6483 ( 0.3) 81 ( 0.0)

25 Table 1 ALL After Inclusion/Exclusion

varsTable1 <- c("age", "gender2", "ethnicity2", "BMI_Ranges", "icu_admit_source2","physicianSpeciality2",  "hospitaldischargeyear", "hospital_teaching_status", "hospital_size", "hospital_region2","dialysis", "aids", "hepaticfailure",  "diabetes", "immunosuppression", "leukemia", "lymphoma", "metastaticcancer", "thrombolytics", "sofa_respiration_baseline2", "cardiovascular_baseline","SIRS_Positive", "qSOFA_Positive", "SOFA_Positive", "SepsisFuzzyLogicPositive","apacheiva", "hospital_mortality_ultimate", "icu_mortality", "hospital_los", "icu_los", "sepsis_outcome","group")

library(dplyr); library(Hmisc); library(ggplot2); library(sjPlot)

if(!("tableone" %in% rownames(installed.packages()))) {
  install.packages("tableone")
}

library(tableone)

CreateTableOne(data=ssd_incl ,vars=varsTable1,strata="hospital_mortality_ultimate",test=TRUE, includeNA=TRUE
) %>% print(nonnormal= c("icu_mortality", "sepsis_outcome","hospital_teaching_status"),minMax=TRUE,
  printToggle      = FALSE,
  showAllLevels    = TRUE,
  cramVars         = "kon"
) %>%
{data.frame(
  variable_name             = gsub(" ", "&nbsp;", rownames(.), fixed = TRUE), .,                                                                                                                     
  row.names        = NULL,
  check.names      = FALSE,
  stringsAsFactors = FALSE)} %>%
  knitr::kable(caption="Demographic, Severity of Illness, Diagnostic, and Outcome Data")
Demographic, Severity of Illness, Diagnostic, and Outcome Data
variable_name level 0 1 p test
n 826290 86219
age (mean (sd)) 62.26 (17.20) 69.51 (15.00) <0.001
gender2 (%) Male 444766 ( 53.8) 45767 ( 53.1) <0.001
Female 381402 ( 46.2) 40346 ( 46.8)
Other/Unknown 122 ( 0.0) 106 ( 0.1)
ethnicity2 (%) Caucasian 629231 ( 76.2) 66136 ( 76.7) <0.001
African American 96168 ( 11.6) 9124 ( 10.6)
Hispanic 37359 ( 4.5) 4034 ( 4.7)
Asian 10468 ( 1.3) 1227 ( 1.4)
Native American 6085 ( 0.7) 680 ( 0.8)
Other/Unknown 46979 ( 5.7) 5018 ( 5.8)
BMI_Ranges (%) (0,18.5] 37672 ( 4.6) 6337 ( 7.3) <0.001
(18.5,25] 230063 ( 27.8) 27575 ( 32.0)
(25,35] 381728 ( 46.2) 34794 ( 40.4)
(35,200] 148643 ( 18.0) 13411 ( 15.6)
Other/Unknown 28184 ( 3.4) 4102 ( 4.8)
icu_admit_source2 (%) Floor 131068 ( 15.9) 23568 ( 27.3) <0.001
OR/Proc Area 169828 ( 20.6) 6615 ( 7.7)
Direct Admit 87805 ( 10.6) 10233 ( 11.9)
Emergency Department 415282 ( 50.3) 41193 ( 47.8)
Other 6616 ( 0.8) 1147 ( 1.3)
Step-Down Unit 15691 ( 1.9) 3463 ( 4.0)
physicianSpeciality2 (%) Critical Care 235008 ( 28.4) 32228 ( 37.4) <0.001
Speciality-Other 591282 ( 71.6) 53991 ( 62.6)
hospitaldischargeyear (%) -2010 100104 ( 12.1) 11426 ( 13.3) <0.001
2011 109790 ( 13.3) 12246 ( 14.2)
2012 134912 ( 16.3) 14257 ( 16.5)
2013 151717 ( 18.4) 15581 ( 18.1)
2014 162398 ( 19.7) 15789 ( 18.3)
2015-16 167369 ( 20.3) 16920 ( 19.6)
hospital_teaching_status (%) 34473 ( 4.2) 3442 ( 4.0) <0.001
f 543349 ( 65.8) 54693 ( 63.4)
t 248468 ( 30.1) 28084 ( 32.6)
hospital_size (%) 66107 ( 8.0) 6571 ( 7.6) <0.001
<100 34747 ( 4.2) 2025 ( 2.3)
100-249 190062 ( 23.0) 17055 ( 19.8)
250-500 151081 ( 18.3) 16032 ( 18.6)
>500 384293 ( 46.5) 44536 ( 51.7)
hospital_region2 (%) Midwest 352325 ( 42.6) 30750 ( 35.7) <0.001
Northeast 63922 ( 7.7) 9601 ( 11.1)
South 256647 ( 31.1) 27340 ( 31.7)
West 102962 ( 12.5) 13821 ( 16.0)
Unknown 50434 ( 6.1) 4707 ( 5.5)
dialysis (%) 0 799492 ( 96.8) 82383 ( 95.6) <0.001
1 26798 ( 3.2) 3836 ( 4.4)
aids (%) 0 825524 ( 99.9) 86095 ( 99.9) <0.001
1 766 ( 0.1) 124 ( 0.1)
hepaticfailure (%) FALSE 810457 ( 98.1) 82987 ( 96.3) <0.001
TRUE 15833 ( 1.9) 3232 ( 3.7)
diabetes (%) 0 642502 ( 77.8) 70191 ( 81.4) <0.001
1 183788 ( 22.2) 16028 ( 18.6)
immunosuppression (%) 0 808507 ( 97.8) 82621 ( 95.8) <0.001
1 17783 ( 2.2) 3598 ( 4.2)
leukemia (%) 0 820977 ( 99.4) 84948 ( 98.5) <0.001
1 5313 ( 0.6) 1271 ( 1.5)
lymphoma (%) 0 823248 ( 99.6) 85647 ( 99.3) <0.001
1 3042 ( 0.4) 572 ( 0.7)
metastaticcancer (%) 0 812021 ( 98.3) 82981 ( 96.2) <0.001
1 14269 ( 1.7) 3238 ( 3.8)
thrombolytics (%) 0 810938 ( 98.1) 84836 ( 98.4) <0.001
1 15352 ( 1.9) 1383 ( 1.6)
sofa_respiration_baseline2 (%) FALSE 630876 ( 76.4) 61776 ( 71.7) <0.001
TRUE 195414 ( 23.6) 24443 ( 28.3)
cardiovascular_baseline (%) 0 642985 ( 77.8) 62318 ( 72.3) <0.001
1 183305 ( 22.2) 23901 ( 27.7)
SIRS_Positive (%) FALSE 212707 ( 25.7) 5948 ( 6.9) <0.001
TRUE 613583 ( 74.3) 80271 ( 93.1)
qSOFA_Positive (%) FALSE 291347 ( 35.3) 8146 ( 9.4) <0.001
TRUE 534943 ( 64.7) 78073 ( 90.6)
SOFA_Positive (%) FALSE 279544 ( 33.8) 4749 ( 5.5) <0.001
TRUE 546746 ( 66.2) 81470 ( 94.5)
SepsisFuzzyLogicPositive (%) FALSE 398466 ( 48.2) 11535 ( 13.4) <0.001
TRUE 427824 ( 51.8) 74684 ( 86.6)
apacheiva (mean (sd)) 51.90 (22.17) 90.36 (31.77) <0.001
hospital_mortality_ultimate (%) 0 826290 (100.0) 0 ( 0.0) <0.001
1 0 ( 0.0) 86219 (100.0)
icu_mortality (%) 0 826246 (100.0) 24853 ( 28.8) <0.001
1 0 ( 0.0) 61357 ( 71.2)
NA 44 ( 0.0) 9 ( 0.0)
hospital_los (mean (sd)) 7.69 (9.37) 7.97 (11.80) <0.001
icu_los (mean (sd)) 2.93 (3.85) 4.49 (5.84) <0.001
sepsis_outcome (%) FALSE 674037 ( 81.6) 51602 ( 59.8) <0.001
TRUE 152253 ( 18.4) 34617 ( 40.2)
group (%) Cardiovascular 270546 ( 32.7) 24802 ( 28.8) <0.001
Gastrointestinal 87106 ( 10.5) 7567 ( 8.8)
Gynaecological 2381 ( 0.3) 29 ( 0.0)
Hematological 6220 ( 0.8) 599 ( 0.7)
Metabolic 73481 ( 8.9) 1384 ( 1.6)
Muscoskeletal/Skin disease 10969 ( 1.3) 486 ( 0.6)
Neurological 111809 ( 13.5) 11101 ( 12.9)
Renal/Genitourinary 20549 ( 2.5) 1576 ( 1.8)
Respiratory 118873 ( 14.4) 17182 ( 19.9)
Sepsis 79999 ( 9.7) 17599 ( 20.4)
Trauma 37405 ( 4.5) 3090 ( 3.6)
Undefined 6952 ( 0.8) 804 ( 0.9)
CreateTableOne(data=ssd_incl ,vars=varsTable1,strata="sepsis_outcome",test=TRUE, includeNA=TRUE
) %>% print(nonnormal= c("hospital_mortality_ultimate", "icu_mortality", "hospital_teaching_status"),minMax=TRUE,
  printToggle      = FALSE,
  showAllLevels    = TRUE,
  cramVars         = "kon"
) %>%
{data.frame(
  variable_name             = gsub(" ", "&nbsp;", rownames(.), fixed = TRUE), .,                                                                                                                     
  row.names        = NULL,
  check.names      = FALSE,
  stringsAsFactors = FALSE)} %>%
  knitr::kable(caption="Demographic, Severity of Illness, Diagnostic, and Outcome Data")
Demographic, Severity of Illness, Diagnostic, and Outcome Data
variable_name level FALSE TRUE p test
n 725639 186870
age (mean (sd)) 62.23 (17.30) 65.70 (16.18) <0.001
gender2 (%) Male 395985 ( 54.6) 94548 ( 50.6) <0.001
Female 329455 ( 45.4) 92293 ( 49.4)
Other/Unknown 199 ( 0.0) 29 ( 0.0)
ethnicity2 (%) Caucasian 553821 ( 76.3) 141546 ( 75.7) <0.001
African American 84902 ( 11.7) 20390 ( 10.9)
Hispanic 30536 ( 4.2) 10857 ( 5.8)
Asian 9221 ( 1.3) 2474 ( 1.3)
Native American 5248 ( 0.7) 1517 ( 0.8)
Other/Unknown 41911 ( 5.8) 10086 ( 5.4)
BMI_Ranges (%) (0,18.5] 31764 ( 4.4) 12245 ( 6.6) <0.001
(18.5,25] 202170 ( 27.9) 55468 ( 29.7)
(25,35] 338933 ( 46.7) 77589 ( 41.5)
(35,200] 125888 ( 17.3) 36166 ( 19.4)
Other/Unknown 26884 ( 3.7) 5402 ( 2.9)
icu_admit_source2 (%) Floor 107913 ( 14.9) 46723 ( 25.0) <0.001
OR/Proc Area 166553 ( 23.0) 9890 ( 5.3)
Direct Admit 80562 ( 11.1) 17476 ( 9.4)
Emergency Department 351730 ( 48.5) 104745 ( 56.1)
Other 5693 ( 0.8) 2070 ( 1.1)
Step-Down Unit 13188 ( 1.8) 5966 ( 3.2)
physicianSpeciality2 (%) Critical Care 194821 ( 26.8) 72415 ( 38.8) <0.001
Speciality-Other 530818 ( 73.2) 114455 ( 61.2)
hospitaldischargeyear (%) -2010 88588 ( 12.2) 22942 ( 12.3) <0.001
2011 95007 ( 13.1) 27029 ( 14.5)
2012 119084 ( 16.4) 30085 ( 16.1)
2013 133576 ( 18.4) 33722 ( 18.0)
2014 142947 ( 19.7) 35240 ( 18.9)
2015-16 146437 ( 20.2) 37852 ( 20.3)
hospital_teaching_status (%) 30704 ( 4.2) 7211 ( 3.9) <0.001
f 476998 ( 65.7) 121044 ( 64.8)
t 217937 ( 30.0) 58615 ( 31.4)
hospital_size (%) 58989 ( 8.1) 13689 ( 7.3) <0.001
<100 26993 ( 3.7) 9779 ( 5.2)
100-249 163833 ( 22.6) 43284 ( 23.2)
250-500 131717 ( 18.2) 35396 ( 18.9)
>500 344107 ( 47.4) 84722 ( 45.3)
hospital_region2 (%) Midwest 313401 ( 43.2) 69674 ( 37.3) <0.001
Northeast 46163 ( 6.4) 27360 ( 14.6)
South 229437 ( 31.6) 54550 ( 29.2)
West 90846 ( 12.5) 25937 ( 13.9)
Unknown 45792 ( 6.3) 9349 ( 5.0)
dialysis (%) 0 702756 ( 96.8) 179119 ( 95.9) <0.001
1 22883 ( 3.2) 7751 ( 4.1)
aids (%) 0 725221 ( 99.9) 186398 ( 99.7) <0.001
1 418 ( 0.1) 472 ( 0.3)
hepaticfailure (%) FALSE 711408 ( 98.0) 182036 ( 97.4) <0.001
TRUE 14231 ( 2.0) 4834 ( 2.6)
diabetes (%) 0 566573 ( 78.1) 146120 ( 78.2) 0.288
1 159066 ( 21.9) 40750 ( 21.8)
immunosuppression (%) 0 711733 ( 98.1) 179395 ( 96.0) <0.001
1 13906 ( 1.9) 7475 ( 4.0)
leukemia (%) 0 721482 ( 99.4) 184443 ( 98.7) <0.001
1 4157 ( 0.6) 2427 ( 1.3)
lymphoma (%) 0 723226 ( 99.7) 185669 ( 99.4) <0.001
1 2413 ( 0.3) 1201 ( 0.6)
metastaticcancer (%) 0 712655 ( 98.2) 182347 ( 97.6) <0.001
1 12984 ( 1.8) 4523 ( 2.4)
thrombolytics (%) 0 709288 ( 97.7) 186486 ( 99.8) <0.001
1 16351 ( 2.3) 384 ( 0.2)
sofa_respiration_baseline2 (%) FALSE 569370 ( 78.5) 123282 ( 66.0) <0.001
TRUE 156269 ( 21.5) 63588 ( 34.0)
cardiovascular_baseline (%) 0 564204 ( 77.8) 141099 ( 75.5) <0.001
1 161435 ( 22.2) 45771 ( 24.5)
SIRS_Positive (%) FALSE 197738 ( 27.3) 20917 ( 11.2) <0.001
TRUE 527901 ( 72.7) 165953 ( 88.8)
qSOFA_Positive (%) FALSE 265487 ( 36.6) 34006 ( 18.2) <0.001
TRUE 460152 ( 63.4) 152864 ( 81.8)
SOFA_Positive (%) FALSE 258188 ( 35.6) 26105 ( 14.0) <0.001
TRUE 467451 ( 64.4) 160765 ( 86.0)
SepsisFuzzyLogicPositive (%) FALSE 375201 ( 51.7) 34800 ( 18.6) <0.001
TRUE 350438 ( 48.3) 152070 ( 81.4)
apacheiva (mean (sd)) 51.95 (23.95) 69.47 (28.02) <0.001
hospital_mortality_ultimate (%) 0 674037 ( 92.9) 152253 ( 81.5) <0.001
1 51602 ( 7.1) 34617 ( 18.5)
icu_mortality (%) 0 689161 ( 95.0) 161938 ( 86.7) <0.001
1 36436 ( 5.0) 24921 ( 13.3)
NA 42 ( 0.0) 11 ( 0.0)
hospital_los (mean (sd)) 7.05 (8.71) 10.31 (12.24) <0.001
icu_los (mean (sd)) 2.79 (3.75) 4.20 (5.13) <0.001
sepsis_outcome (%) FALSE 725639 (100.0) 0 ( 0.0) <0.001
TRUE 0 ( 0.0) 186870 (100.0)
group (%) Cardiovascular 275329 ( 37.9) 20019 ( 10.7) <0.001
Gastrointestinal 83127 ( 11.5) 11546 ( 6.2)
Gynaecological 2293 ( 0.3) 117 ( 0.1)
Hematological 5761 ( 0.8) 1058 ( 0.6)
Metabolic 68815 ( 9.5) 6050 ( 3.2)
Muscoskeletal/Skin disease 9185 ( 1.3) 2270 ( 1.2)
Neurological 113662 ( 15.7) 9248 ( 4.9)
Renal/Genitourinary 17170 ( 2.4) 4955 ( 2.7)
Respiratory 89707 ( 12.4) 46348 ( 24.8)
Sepsis 14033 ( 1.9) 83565 ( 44.7)
Trauma 39475 ( 5.4) 1020 ( 0.5)
Undefined 7082 ( 1.0) 674 ( 0.4)

26 Table 1 Test Dataset

varsTable1 <- c("age", "gender2", "ethnicity2", "BMI_Ranges", "icu_admit_source2","physicianSpeciality2", "hospitaldischargeyear", "hospital_teaching_status", "hospital_size", "hospital_region2","dialysis", "aids", "hepaticfailure",  "diabetes", "immunosuppression", "leukemia", "lymphoma", "metastaticcancer", "thrombolytics", "sofa_respiration_baseline2", "cardiovascular_baseline","SIRS_Positive", "qSOFA_Positive", "SOFA_Positive", "SepsisFuzzyLogicPositive","apacheiva", "hospital_mortality_ultimate", "icu_mortality", "hospital_los", "icu_los","sepsis_outcome", "group")

library(dplyr); library(Hmisc); library(ggplot2); library(sjPlot)

if(!("tableone" %in% rownames(installed.packages()))) {
  install.packages("tableone")
}

library(tableone)

CreateTableOne(data=ssd_incl_te ,vars=varsTable1,strata="hospital_mortality_ultimate",test=TRUE, includeNA=TRUE
) %>% print(nonnormal= c("icu_mortality", "sepsis_outcome","hospital_teaching_status"),minMax=TRUE,
  printToggle      = FALSE,
  showAllLevels    = TRUE,
  cramVars         = "kon"
) %>%
{data.frame(
  variable_name             = gsub(" ", "&nbsp;", rownames(.), fixed = TRUE), .,                                                                                                                     
  row.names        = NULL,
  check.names      = FALSE,
  stringsAsFactors = FALSE)} %>%
  knitr::kable(caption="Demographic, Severity of Illness, Diagnostic, and Outcome Data")
Demographic, Severity of Illness, Diagnostic, and Outcome Data
variable_name level FALSE TRUE p test
n 247887 25865
age (mean (sd)) 62.23 (17.23) 69.63 (14.92) <0.001
gender2 (%) Male 133288 ( 53.8) 13614 ( 52.6) <0.001
Female 114558 ( 46.2) 12212 ( 47.2)
Other/Unknown 41 ( 0.0) 39 ( 0.2)
ethnicity2 (%) Caucasian 188789 ( 76.2) 19899 ( 76.9) <0.001
African American 28950 ( 11.7) 2779 ( 10.7)
Hispanic 11097 ( 4.5) 1188 ( 4.6)
Asian 3171 ( 1.3) 362 ( 1.4)
Native American 1834 ( 0.7) 178 ( 0.7)
Other/Unknown 14046 ( 5.7) 1459 ( 5.6)
BMI_Ranges (%) (0,18.5] 11536 ( 4.7) 1912 ( 7.4) <0.001
(18.5,25] 68576 ( 27.7) 8299 ( 32.1)
(25,35] 114763 ( 46.3) 10449 ( 40.4)
(35,200] 44499 ( 18.0) 3958 ( 15.3)
Other/Unknown 8513 ( 3.4) 1247 ( 4.8)
icu_admit_source2 (%) Floor 39313 ( 15.9) 7121 ( 27.5) <0.001
OR/Proc Area 50962 ( 20.6) 1969 ( 7.6)
Direct Admit 26416 ( 10.7) 3055 ( 11.8)
Emergency Department 124404 ( 50.2) 12270 ( 47.4)
Other 1995 ( 0.8) 365 ( 1.4)
Step-Down Unit 4797 ( 1.9) 1085 ( 4.2)
physicianSpeciality2 (%) Critical Care 70540 ( 28.5) 9755 ( 37.7) <0.001
Speciality-Other 177347 ( 71.5) 16110 ( 62.3)
hospitaldischargeyear (%) -2010 29982 ( 12.1) 3366 ( 13.0) <0.001
2011 33134 ( 13.4) 3680 ( 14.2)
2012 40551 ( 16.4) 4259 ( 16.5)
2013 45509 ( 18.4) 4753 ( 18.4)
2014 48843 ( 19.7) 4708 ( 18.2)
2015-16 49868 ( 20.1) 5099 ( 19.7)
hospital_teaching_status (%) 10370 ( 4.2) 1051 ( 4.1) <0.001
f 162894 ( 65.7) 16377 ( 63.3)
t 74623 ( 30.1) 8437 ( 32.6)
hospital_size (%) 19895 ( 8.0) 1985 ( 7.7) <0.001
<100 10464 ( 4.2) 614 ( 2.4)
100-249 56948 ( 23.0) 5071 ( 19.6)
250-500 45347 ( 18.3) 4859 ( 18.8)
>500 115233 ( 46.5) 13336 ( 51.6)
hospital_region2 (%) Midwest 105735 ( 42.7) 9171 ( 35.5) <0.001
Northeast 19043 ( 7.7) 2962 ( 11.5)
South 77072 ( 31.1) 8209 ( 31.7)
West 30786 ( 12.4) 4083 ( 15.8)
Unknown 15251 ( 6.2) 1440 ( 5.6)
dialysis (%) 0 239806 ( 96.7) 24688 ( 95.4) <0.001
1 8081 ( 3.3) 1177 ( 4.6)
aids (%) 0 247657 ( 99.9) 25832 ( 99.9) 0.107
1 230 ( 0.1) 33 ( 0.1)
hepaticfailure (%) FALSE 243163 ( 98.1) 24908 ( 96.3) <0.001
TRUE 4724 ( 1.9) 957 ( 3.7)
diabetes (%) 0 192864 ( 77.8) 21056 ( 81.4) <0.001
1 55023 ( 22.2) 4809 ( 18.6)
immunosuppression (%) 0 242591 ( 97.9) 24795 ( 95.9) <0.001
1 5296 ( 2.1) 1070 ( 4.1)
leukemia (%) 0 246333 ( 99.4) 25481 ( 98.5) <0.001
1 1554 ( 0.6) 384 ( 1.5)
lymphoma (%) 0 247024 ( 99.7) 25698 ( 99.4) <0.001
1 863 ( 0.3) 167 ( 0.6)
metastaticcancer (%) 0 243535 ( 98.2) 24911 ( 96.3) <0.001
1 4352 ( 1.8) 954 ( 3.7)
thrombolytics (%) 0 243323 ( 98.2) 25461 ( 98.4) 0.001
1 4564 ( 1.8) 404 ( 1.6)
sofa_respiration_baseline2 (%) FALSE 189447 ( 76.4) 18561 ( 71.8) <0.001
TRUE 58440 ( 23.6) 7304 ( 28.2)
cardiovascular_baseline (%) 0 193108 ( 77.9) 18753 ( 72.5) <0.001
1 54779 ( 22.1) 7112 ( 27.5)
SIRS_Positive (%) FALSE 63427 ( 25.6) 1792 ( 6.9) <0.001
TRUE 184460 ( 74.4) 24073 ( 93.1)
qSOFA_Positive (%) FALSE 87257 ( 35.2) 2429 ( 9.4) <0.001
TRUE 160630 ( 64.8) 23436 ( 90.6)
SOFA_Positive (%) FALSE 83807 ( 33.8) 1464 ( 5.7) <0.001
TRUE 164080 ( 66.2) 24401 ( 94.3)
SepsisFuzzyLogicPositive (%) FALSE 119438 ( 48.2) 3492 ( 13.5) <0.001
TRUE 128449 ( 51.8) 22373 ( 86.5)
apacheiva (mean (sd)) 51.90 (22.21) 90.36 (31.62) <0.001
hospital_mortality_ultimate (%) FALSE 247887 (100.0) 0 ( 0.0) <0.001
TRUE 0 ( 0.0) 25865 (100.0)
icu_mortality (%) 0 247870 (100.0) 7507 ( 29.0) <0.001
1 0 ( 0.0) 18355 ( 71.0)
NA 17 ( 0.0) 3 ( 0.0)
hospital_los (mean (sd)) 7.74 (10.56) 7.96 (10.32) 0.001
icu_los (mean (sd)) 2.94 (3.90) 4.46 (5.87) <0.001
sepsis_outcome (%) FALSE 202080 ( 81.5) 15416 ( 59.6) <0.001
TRUE 45807 ( 18.5) 10449 ( 40.4)
group (%) Cardiovascular 80965 ( 32.7) 7398 ( 28.6) <0.001
Gastrointestinal 26265 ( 10.6) 2279 ( 8.8)
Gynaecological 706 ( 0.3) 9 ( 0.0)
Hematological 1915 ( 0.8) 171 ( 0.7)
Metabolic 22029 ( 8.9) 432 ( 1.7)
Muscoskeletal/Skin disease 3332 ( 1.3) 126 ( 0.5)
Neurological 33500 ( 13.5) 3337 ( 12.9)
Renal/Genitourinary 6101 ( 2.5) 475 ( 1.8)
Respiratory 35716 ( 14.4) 5142 ( 19.9)
Sepsis 24033 ( 9.7) 5304 ( 20.5)
Trauma 11196 ( 4.5) 929 ( 3.6)
Undefined 2129 ( 0.9) 263 ( 1.0)
CreateTableOne(data=ssd_incl_te ,vars=varsTable1,strata="sepsis_outcome",test=TRUE, includeNA=TRUE
) %>% print(nonnormal= c("hospital_mortality_ultimate", "icu_mortality", "hospital_teaching_status"),minMax=TRUE,
  printToggle      = FALSE,
  showAllLevels    = TRUE,
  cramVars         = "kon"
) %>%
{data.frame(
  variable_name             = gsub(" ", "&nbsp;", rownames(.), fixed = TRUE), .,                                                                                                                     
  row.names        = NULL,
  check.names      = FALSE,
  stringsAsFactors = FALSE)} %>%
  knitr::kable(caption="Demographic, Severity of Illness, Diagnostic, and Outcome Data")
Demographic, Severity of Illness, Diagnostic, and Outcome Data
variable_name level FALSE TRUE p test
n 217496 56256
age (mean (sd)) 62.21 (17.32) 65.70 (16.27) <0.001
gender2 (%) Male 118663 ( 54.6) 28239 ( 50.2) <0.001
Female 98765 ( 45.4) 28005 ( 49.8)
Other/Unknown 68 ( 0.0) 12 ( 0.0)
ethnicity2 (%) Caucasian 166045 ( 76.3) 42643 ( 75.8) <0.001
African American 25606 ( 11.8) 6123 ( 10.9)
Hispanic 9025 ( 4.1) 3260 ( 5.8)
Asian 2785 ( 1.3) 748 ( 1.3)
Native American 1558 ( 0.7) 454 ( 0.8)
Other/Unknown 12477 ( 5.7) 3028 ( 5.4)
BMI_Ranges (%) (0,18.5] 9746 ( 4.5) 3702 ( 6.6) <0.001
(18.5,25] 60170 ( 27.7) 16705 ( 29.7)
(25,35] 101869 ( 46.8) 23343 ( 41.5)
(35,200] 37638 ( 17.3) 10819 ( 19.2)
Other/Unknown 8073 ( 3.7) 1687 ( 3.0)
icu_admit_source2 (%) Floor 32429 ( 14.9) 14005 ( 24.9) <0.001
OR/Proc Area 49937 ( 23.0) 2994 ( 5.3)
Direct Admit 24281 ( 11.2) 5190 ( 9.2)
Emergency Department 105092 ( 48.3) 31582 ( 56.1)
Other 1722 ( 0.8) 638 ( 1.1)
Step-Down Unit 4035 ( 1.9) 1847 ( 3.3)
physicianSpeciality2 (%) Critical Care 58418 ( 26.9) 21877 ( 38.9) <0.001
Speciality-Other 159078 ( 73.1) 34379 ( 61.1)
hospitaldischargeyear (%) -2010 26447 ( 12.2) 6901 ( 12.3) <0.001
2011 28696 ( 13.2) 8118 ( 14.4)
2012 35707 ( 16.4) 9103 ( 16.2)
2013 40113 ( 18.4) 10149 ( 18.0)
2014 42963 ( 19.8) 10588 ( 18.8)
2015-16 43570 ( 20.0) 11397 ( 20.3)
hospital_teaching_status (%) 9199 ( 4.2) 2222 ( 3.9) <0.001
f 143044 ( 65.8) 36227 ( 64.4)
t 65253 ( 30.0) 17807 ( 31.7)
hospital_size (%) 17716 ( 8.1) 4164 ( 7.4) <0.001
<100 8157 ( 3.8) 2921 ( 5.2)
100-249 48999 ( 22.5) 13020 ( 23.1)
250-500 39608 ( 18.2) 10598 ( 18.8)
>500 103016 ( 47.4) 25553 ( 45.4)
hospital_region2 (%) Midwest 93946 ( 43.2) 20960 ( 37.3) <0.001
Northeast 13710 ( 6.3) 8295 ( 14.7)
South 68820 ( 31.6) 16461 ( 29.3)
West 27201 ( 12.5) 7668 ( 13.6)
Unknown 13819 ( 6.4) 2872 ( 5.1)
dialysis (%) 0 210546 ( 96.8) 53948 ( 95.9) <0.001
1 6950 ( 3.2) 2308 ( 4.1)
aids (%) 0 217391 (100.0) 56098 ( 99.7) <0.001
1 105 ( 0.0) 158 ( 0.3)
hepaticfailure (%) FALSE 213245 ( 98.0) 54826 ( 97.5) <0.001
TRUE 4251 ( 2.0) 1430 ( 2.5)
diabetes (%) 0 169968 ( 78.1) 43952 ( 78.1) 0.927
1 47528 ( 21.9) 12304 ( 21.9)
immunosuppression (%) 0 213347 ( 98.1) 54039 ( 96.1) <0.001
1 4149 ( 1.9) 2217 ( 3.9)
leukemia (%) 0 216306 ( 99.5) 55508 ( 98.7) <0.001
1 1190 ( 0.5) 748 ( 1.3)
lymphoma (%) 0 216810 ( 99.7) 55912 ( 99.4) <0.001
1 686 ( 0.3) 344 ( 0.6)
metastaticcancer (%) 0 213552 ( 98.2) 54894 ( 97.6) <0.001
1 3944 ( 1.8) 1362 ( 2.4)
thrombolytics (%) 0 212624 ( 97.8) 56160 ( 99.8) <0.001
1 4872 ( 2.2) 96 ( 0.2)
sofa_respiration_baseline2 (%) FALSE 170825 ( 78.5) 37183 ( 66.1) <0.001
TRUE 46671 ( 21.5) 19073 ( 33.9)
cardiovascular_baseline (%) 0 169312 ( 77.8) 42549 ( 75.6) <0.001
1 48184 ( 22.2) 13707 ( 24.4)
SIRS_Positive (%) FALSE 59019 ( 27.1) 6200 ( 11.0) <0.001
TRUE 158477 ( 72.9) 50056 ( 89.0)
qSOFA_Positive (%) FALSE 79553 ( 36.6) 10133 ( 18.0) <0.001
TRUE 137943 ( 63.4) 46123 ( 82.0)
SOFA_Positive (%) FALSE 77471 ( 35.6) 7800 ( 13.9) <0.001
TRUE 140025 ( 64.4) 48456 ( 86.1)
SepsisFuzzyLogicPositive (%) FALSE 112558 ( 51.8) 10372 ( 18.4) <0.001
TRUE 104938 ( 48.2) 45884 ( 81.6)
apacheiva (mean (sd)) 51.93 (23.93) 69.48 (28.13) <0.001
hospital_mortality_ultimate (%) FALSE 202080 ( 92.9) 45807 ( 81.4) <0.001
TRUE 15416 ( 7.1) 10449 ( 18.6)
icu_mortality (%) 0 206618 ( 95.0) 48759 ( 86.7) <0.001
1 10863 ( 5.0) 7492 ( 13.3)
NA 15 ( 0.0) 5 ( 0.0)
hospital_los (mean (sd)) 7.08 (9.34) 10.38 (13.93) <0.001
icu_los (mean (sd)) 2.79 (3.78) 4.22 (5.20) <0.001
sepsis_outcome (%) FALSE 217496 (100.0) 0 ( 0.0) <0.001
TRUE 0 ( 0.0) 56256 (100.0)
group (%) Cardiovascular 82285 ( 37.8) 6078 ( 10.8) <0.001
Gastrointestinal 25028 ( 11.5) 3516 ( 6.2)
Gynaecological 682 ( 0.3) 33 ( 0.1)
Hematological 1779 ( 0.8) 307 ( 0.5)
Metabolic 20612 ( 9.5) 1849 ( 3.3)
Muscoskeletal/Skin disease 2779 ( 1.3) 679 ( 1.2)
Neurological 34048 ( 15.7) 2789 ( 5.0)
Renal/Genitourinary 5089 ( 2.3) 1487 ( 2.6)
Respiratory 26953 ( 12.4) 13905 ( 24.7)
Sepsis 4250 ( 2.0) 25087 ( 44.6)
Trauma 11811 ( 5.4) 314 ( 0.6)
Undefined 2180 ( 1.0) 212 ( 0.4)

27 Table 1 Train Dataset

varsTable1 <- c("age", "gender2", "ethnicity2", "BMI_Ranges", "icu_admit_source2","physicianSpeciality2",  "hospitaldischargeyear", "hospital_teaching_status", "hospital_size", "hospital_region2","dialysis", "aids", "hepaticfailure", "diabetes", "immunosuppression", "leukemia", "lymphoma", "metastaticcancer", "thrombolytics", "sofa_respiration_baseline2", "cardiovascular_baseline","SIRS_Positive", "qSOFA_Positive", "SOFA_Positive", "SepsisFuzzyLogicPositive","apacheiva", "hospital_mortality_ultimate", "icu_mortality", "hospital_los", "icu_los","sepsis_outcome","group")

library(dplyr); library(Hmisc); library(ggplot2); library(sjPlot)

if(!("tableone" %in% rownames(installed.packages()))) {
  install.packages("tableone")
}

library(tableone)

CreateTableOne(data=ssd_incl_tr ,vars=varsTable1,strata="hospital_mortality_ultimate",test=TRUE, includeNA=TRUE
) %>% print(nonnormal= c("icu_mortality", "hospital_teaching_status"),minMax=TRUE,
  printToggle      = FALSE,
  showAllLevels    = TRUE,
  cramVars         = "kon"
) %>%
{data.frame(
  variable_name             = gsub(" ", "&nbsp;", rownames(.), fixed = TRUE), .,                                                                                                                     
  row.names        = NULL,
  check.names      = FALSE,
  stringsAsFactors = FALSE)} %>%
  knitr::kable(caption="Demographic, Severity of Illness, Diagnostic, and Outcome Data")
Demographic, Severity of Illness, Diagnostic, and Outcome Data
variable_name level 0 1 p test
n 578403 60354
age (mean (sd)) 62.27 (17.19) 69.45 (15.04) <0.001
gender2 (%) Male 311478 ( 53.9) 32153 ( 53.3) <0.001
Female 266844 ( 46.1) 28134 ( 46.6)
Other/Unknown 81 ( 0.0) 67 ( 0.1)
ethnicity2 (%) Caucasian 440442 ( 76.1) 46237 ( 76.6) <0.001
African American 67218 ( 11.6) 6345 ( 10.5)
Hispanic 26262 ( 4.5) 2846 ( 4.7)
Asian 7297 ( 1.3) 865 ( 1.4)
Native American 4251 ( 0.7) 502 ( 0.8)
Other/Unknown 32933 ( 5.7) 3559 ( 5.9)
BMI_Ranges (%) (0,18.5] 26136 ( 4.5) 4425 ( 7.3) <0.001
(18.5,25] 161487 ( 27.9) 19276 ( 31.9)
(25,35] 266965 ( 46.2) 24345 ( 40.3)
(35,200] 104144 ( 18.0) 9453 ( 15.7)
Other/Unknown 19671 ( 3.4) 2855 ( 4.7)
icu_admit_source2 (%) Floor 91755 ( 15.9) 16447 ( 27.3) <0.001
OR/Proc Area 118866 ( 20.6) 4646 ( 7.7)
Direct Admit 61389 ( 10.6) 7178 ( 11.9)
Emergency Department 290878 ( 50.3) 28923 ( 47.9)
Other 4621 ( 0.8) 782 ( 1.3)
Step-Down Unit 10894 ( 1.9) 2378 ( 3.9)
physicianSpeciality2 (%) Critical Care 164468 ( 28.4) 22473 ( 37.2) <0.001
Speciality-Other 413935 ( 71.6) 37881 ( 62.8)
hospitaldischargeyear (%) -2010 70122 ( 12.1) 8060 ( 13.4) <0.001
2011 76656 ( 13.3) 8566 ( 14.2)
2012 94361 ( 16.3) 9998 ( 16.6)
2013 106208 ( 18.4) 10828 ( 17.9)
2014 113555 ( 19.6) 11081 ( 18.4)
2015-16 117501 ( 20.3) 11821 ( 19.6)
hospital_teaching_status (%) 24103 ( 4.2) 2391 ( 4.0) <0.001
f 380455 ( 65.8) 38316 ( 63.5)
t 173845 ( 30.1) 19647 ( 32.6)
hospital_size (%) 46212 ( 8.0) 4586 ( 7.6) <0.001
<100 24283 ( 4.2) 1411 ( 2.3)
100-249 133114 ( 23.0) 11984 ( 19.9)
250-500 105734 ( 18.3) 11173 ( 18.5)
>500 269060 ( 46.5) 31200 ( 51.7)
hospital_region2 (%) Midwest 246590 ( 42.6) 21579 ( 35.8) <0.001
Northeast 44879 ( 7.8) 6639 ( 11.0)
South 179575 ( 31.0) 19131 ( 31.7)
West 72176 ( 12.5) 9738 ( 16.1)
Unknown 35183 ( 6.1) 3267 ( 5.4)
dialysis (%) 0 559686 ( 96.8) 57695 ( 95.6) <0.001
1 18717 ( 3.2) 2659 ( 4.4)
aids (%) 0 577867 ( 99.9) 60263 ( 99.8) <0.001
1 536 ( 0.1) 91 ( 0.2)
hepaticfailure (%) FALSE 567294 ( 98.1) 58079 ( 96.2) <0.001
TRUE 11109 ( 1.9) 2275 ( 3.8)
diabetes (%) 0 449638 ( 77.7) 49135 ( 81.4) <0.001
1 128765 ( 22.3) 11219 ( 18.6)
immunosuppression (%) 0 565916 ( 97.8) 57826 ( 95.8) <0.001
1 12487 ( 2.2) 2528 ( 4.2)
leukemia (%) 0 574644 ( 99.4) 59467 ( 98.5) <0.001
1 3759 ( 0.6) 887 ( 1.5)
lymphoma (%) 0 576224 ( 99.6) 59949 ( 99.3) <0.001
1 2179 ( 0.4) 405 ( 0.7)
metastaticcancer (%) 0 568486 ( 98.3) 58070 ( 96.2) <0.001
1 9917 ( 1.7) 2284 ( 3.8)
thrombolytics (%) 0 567615 ( 98.1) 59375 ( 98.4) <0.001
1 10788 ( 1.9) 979 ( 1.6)
sofa_respiration_baseline2 (%) FALSE 441429 ( 76.3) 43215 ( 71.6) <0.001
TRUE 136974 ( 23.7) 17139 ( 28.4)
cardiovascular_baseline (%) 0 449877 ( 77.8) 43565 ( 72.2) <0.001
1 128526 ( 22.2) 16789 ( 27.8)
SIRS_Positive (%) FALSE 149280 ( 25.8) 4156 ( 6.9) <0.001
TRUE 429123 ( 74.2) 56198 ( 93.1)
qSOFA_Positive (%) FALSE 204090 ( 35.3) 5717 ( 9.5) <0.001
TRUE 374313 ( 64.7) 54637 ( 90.5)
SOFA_Positive (%) FALSE 195737 ( 33.8) 3285 ( 5.4) <0.001
TRUE 382666 ( 66.2) 57069 ( 94.6)
SepsisFuzzyLogicPositive (%) FALSE 279028 ( 48.2) 8043 ( 13.3) <0.001
TRUE 299375 ( 51.8) 52311 ( 86.7)
apacheiva (mean (sd)) 51.91 (22.15) 90.36 (31.83) <0.001
hospital_mortality_ultimate (%) 0 578403 (100.0) 0 ( 0.0) <0.001
1 0 ( 0.0) 60354 (100.0)
icu_mortality (%) 0 578376 (100.0) 17346 ( 28.7) <0.001
1 0 ( 0.0) 43002 ( 71.2)
NA 27 ( 0.0) 6 ( 0.0)
hospital_los (mean (sd)) 7.67 (8.82) 7.97 (12.38) <0.001
icu_los (mean (sd)) 2.93 (3.83) 4.50 (5.83) <0.001
sepsis_outcome (%) FALSE 471957 ( 81.6) 36186 ( 60.0) <0.001
TRUE 106446 ( 18.4) 24168 ( 40.0)
group (%) Cardiovascular 189581 ( 32.8) 17404 ( 28.8) <0.001
Gastrointestinal 60841 ( 10.5) 5288 ( 8.8)
Gynaecological 1675 ( 0.3) 20 ( 0.0)
Hematological 4305 ( 0.7) 428 ( 0.7)
Metabolic 51452 ( 8.9) 952 ( 1.6)
Muscoskeletal/Skin disease 7637 ( 1.3) 360 ( 0.6)
Neurological 78309 ( 13.5) 7764 ( 12.9)
Renal/Genitourinary 14448 ( 2.5) 1101 ( 1.8)
Respiratory 83157 ( 14.4) 12040 ( 19.9)
Sepsis 55966 ( 9.7) 12295 ( 20.4)
Trauma 26209 ( 4.5) 2161 ( 3.6)
Undefined 4823 ( 0.8) 541 ( 0.9)
CreateTableOne(data=ssd_incl_tr ,vars=varsTable1,strata="sepsis_outcome",test=TRUE, includeNA=TRUE
) %>% print(nonnormal= c("hospital_mortality_ultimate", "icu_mortality", "hospital_teaching_status"),minMax=TRUE,
  printToggle      = FALSE,
  showAllLevels    = TRUE,
  cramVars         = "kon"
) %>%
{data.frame(
  variable_name             = gsub(" ", "&nbsp;", rownames(.), fixed = TRUE), .,                                                                                                                     
  row.names        = NULL,
  check.names      = FALSE,
  stringsAsFactors = FALSE)} %>%
  knitr::kable(caption="Demographic, Severity of Illness, Diagnostic, and Outcome Data")
Demographic, Severity of Illness, Diagnostic, and Outcome Data
variable_name level FALSE TRUE p test
n 508143 130614
age (mean (sd)) 62.24 (17.30) 65.70 (16.15) <0.001
gender2 (%) Male 277322 ( 54.6) 66309 ( 50.8) <0.001
Female 230690 ( 45.4) 64288 ( 49.2)
Other/Unknown 131 ( 0.0) 17 ( 0.0)
ethnicity2 (%) Caucasian 387776 ( 76.3) 98903 ( 75.7) <0.001
African American 59296 ( 11.7) 14267 ( 10.9)
Hispanic 21511 ( 4.2) 7597 ( 5.8)
Asian 6436 ( 1.3) 1726 ( 1.3)
Native American 3690 ( 0.7) 1063 ( 0.8)
Other/Unknown 29434 ( 5.8) 7058 ( 5.4)
BMI_Ranges (%) (0,18.5] 22018 ( 4.3) 8543 ( 6.5) <0.001
(18.5,25] 142000 ( 27.9) 38763 ( 29.7)
(25,35] 237064 ( 46.7) 54246 ( 41.5)
(35,200] 88250 ( 17.4) 25347 ( 19.4)
Other/Unknown 18811 ( 3.7) 3715 ( 2.8)
icu_admit_source2 (%) Floor 75484 ( 14.9) 32718 ( 25.0) <0.001
OR/Proc Area 116616 ( 22.9) 6896 ( 5.3)
Direct Admit 56281 ( 11.1) 12286 ( 9.4)
Emergency Department 246638 ( 48.5) 73163 ( 56.0)
Other 3971 ( 0.8) 1432 ( 1.1)
Step-Down Unit 9153 ( 1.8) 4119 ( 3.2)
physicianSpeciality2 (%) Critical Care 136403 ( 26.8) 50538 ( 38.7) <0.001
Speciality-Other 371740 ( 73.2) 80076 ( 61.3)
hospitaldischargeyear (%) -2010 62141 ( 12.2) 16041 ( 12.3) <0.001
2011 66311 ( 13.0) 18911 ( 14.5)
2012 83377 ( 16.4) 20982 ( 16.1)
2013 93463 ( 18.4) 23573 ( 18.0)
2014 99984 ( 19.7) 24652 ( 18.9)
2015-16 102867 ( 20.2) 26455 ( 20.3)
hospital_teaching_status (%) 21505 ( 4.2) 4989 ( 3.8) <0.001
f 333954 ( 65.7) 84817 ( 64.9)
t 152684 ( 30.0) 40808 ( 31.2)
hospital_size (%) 41273 ( 8.1) 9525 ( 7.3) <0.001
<100 18836 ( 3.7) 6858 ( 5.3)
100-249 114834 ( 22.6) 30264 ( 23.2)
250-500 92109 ( 18.1) 24798 ( 19.0)
>500 241091 ( 47.4) 59169 ( 45.3)
hospital_region2 (%) Midwest 219455 ( 43.2) 48714 ( 37.3) <0.001
Northeast 32453 ( 6.4) 19065 ( 14.6)
South 160617 ( 31.6) 38089 ( 29.2)
West 63645 ( 12.5) 18269 ( 14.0)
Unknown 31973 ( 6.3) 6477 ( 5.0)
dialysis (%) 0 492210 ( 96.9) 125171 ( 95.8) <0.001
1 15933 ( 3.1) 5443 ( 4.2)
aids (%) 0 507830 ( 99.9) 130300 ( 99.8) <0.001
1 313 ( 0.1) 314 ( 0.2)
hepaticfailure (%) FALSE 498163 ( 98.0) 127210 ( 97.4) <0.001
TRUE 9980 ( 2.0) 3404 ( 2.6)
diabetes (%) 0 396605 ( 78.0) 102168 ( 78.2) 0.183
1 111538 ( 22.0) 28446 ( 21.8)
immunosuppression (%) 0 498386 ( 98.1) 125356 ( 96.0) <0.001
1 9757 ( 1.9) 5258 ( 4.0)
leukemia (%) 0 505176 ( 99.4) 128935 ( 98.7) <0.001
1 2967 ( 0.6) 1679 ( 1.3)
lymphoma (%) 0 506416 ( 99.7) 129757 ( 99.3) <0.001
1 1727 ( 0.3) 857 ( 0.7)
metastaticcancer (%) 0 499103 ( 98.2) 127453 ( 97.6) <0.001
1 9040 ( 1.8) 3161 ( 2.4)
thrombolytics (%) 0 496664 ( 97.7) 130326 ( 99.8) <0.001
1 11479 ( 2.3) 288 ( 0.2)
sofa_respiration_baseline2 (%) FALSE 398545 ( 78.4) 86099 ( 65.9) <0.001
TRUE 109598 ( 21.6) 44515 ( 34.1)
cardiovascular_baseline (%) 0 394892 ( 77.7) 98550 ( 75.5) <0.001
1 113251 ( 22.3) 32064 ( 24.5)
SIRS_Positive (%) FALSE 138719 ( 27.3) 14717 ( 11.3) <0.001
TRUE 369424 ( 72.7) 115897 ( 88.7)
qSOFA_Positive (%) FALSE 185934 ( 36.6) 23873 ( 18.3) <0.001
TRUE 322209 ( 63.4) 106741 ( 81.7)
SOFA_Positive (%) FALSE 180717 ( 35.6) 18305 ( 14.0) <0.001
TRUE 327426 ( 64.4) 112309 ( 86.0)
SepsisFuzzyLogicPositive (%) FALSE 262643 ( 51.7) 24428 ( 18.7) <0.001
TRUE 245500 ( 48.3) 106186 ( 81.3)
apacheiva (mean (sd)) 51.96 (23.96) 69.47 (27.97) <0.001
hospital_mortality_ultimate (%) 0 471957 ( 92.9) 106446 ( 81.5) <0.001
1 36186 ( 7.1) 24168 ( 18.5)
icu_mortality (%) 0 482543 ( 95.0) 113179 ( 86.7) <0.001
1 25573 ( 5.0) 17429 ( 13.3)
NA 27 ( 0.0) 6 ( 0.0)
hospital_los (mean (sd)) 7.03 (8.42) 10.28 (11.44) <0.001
icu_los (mean (sd)) 2.79 (3.73) 4.19 (5.11) <0.001
sepsis_outcome (%) FALSE 508143 (100.0) 0 ( 0.0) <0.001
TRUE 0 ( 0.0) 130614 (100.0)
group (%) Cardiovascular 193044 ( 38.0) 13941 ( 10.7) <0.001
Gastrointestinal 58099 ( 11.4) 8030 ( 6.1)
Gynaecological 1611 ( 0.3) 84 ( 0.1)
Hematological 3982 ( 0.8) 751 ( 0.6)
Metabolic 48203 ( 9.5) 4201 ( 3.2)
Muscoskeletal/Skin disease 6406 ( 1.3) 1591 ( 1.2)
Neurological 79614 ( 15.7) 6459 ( 4.9)
Renal/Genitourinary 12081 ( 2.4) 3468 ( 2.7)
Respiratory 62754 ( 12.3) 32443 ( 24.8)
Sepsis 9783 ( 1.9) 58478 ( 44.8)
Trauma 27664 ( 5.4) 706 ( 0.5)
Undefined 4902 ( 1.0) 462 ( 0.4)

28 Table 2 Between Groups

roc.test(SIRS1ADJSepsis.Pred.roc,qSOFA1ADJSepsis.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  SIRS1ADJSepsis.Pred.roc and qSOFA1ADJSepsis.Pred.roc
## Z = 18.208, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.7553989   0.7409462
roc.test(SIRS1ADJSepsis.Pred.roc,SOFA1ADJSepsis.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  SIRS1ADJSepsis.Pred.roc and SOFA1ADJSepsis.Pred.roc
## Z = -13.586, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.7553989   0.7678386
roc.test(SOFA1ADJSepsis.Pred.roc,qSOFA1ADJSepsis.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  SOFA1ADJSepsis.Pred.roc and qSOFA1ADJSepsis.Pred.roc
## Z = 35.98, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.7678386   0.7409462
roc.test(qSOFA2ADJSepsis.Pred.roc,SIRS2ADJSepsis.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  qSOFA2ADJSepsis.Pred.roc and SIRS2ADJSepsis.Pred.roc
## Z = -1.7694, p-value = 0.07683
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.7291955   0.7303764
roc.test(SOFA2ADJSepsis.Pred.roc,SIRS2ADJSepsis.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  SOFA2ADJSepsis.Pred.roc and SIRS2ADJSepsis.Pred.roc
## Z = 11.937, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.7398636   0.7303764
roc.test(FuzzyLogicADJSepsis.Pred.roc,SIRS2ADJSepsis.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  FuzzyLogicADJSepsis.Pred.roc and SIRS2ADJSepsis.Pred.roc
## Z = 52.772, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.7706897   0.7303764
roc.test(FuzzyLogicADJSepsis.Pred.roc,qSOFA2ADJSepsis.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  FuzzyLogicADJSepsis.Pred.roc and qSOFA2ADJSepsis.Pred.roc
## Z = 50.241, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.7706897   0.7291955
roc.test(FuzzyLogicADJSepsis.Pred.roc,SOFA2ADJSepsis.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  FuzzyLogicADJSepsis.Pred.roc and SOFA2ADJSepsis.Pred.roc
## Z = 36.222, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.7706897   0.7398636
roc.test(SOFA2ADJSepsis.Pred.roc,qSOFA2ADJSepsis.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  SOFA2ADJSepsis.Pred.roc and qSOFA2ADJSepsis.Pred.roc
## Z = 15.33, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.7398636   0.7291955
roc.test(SIRS1CrudeSepsis.Pred.roc,qSOFA1CrudeSepsis.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  SIRS1CrudeSepsis.Pred.roc and qSOFA1CrudeSepsis.Pred.roc
## Z = 9.6054, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.6502231   0.6368558
roc.test(SIRS1CrudeSepsis.Pred.roc,SOFA1CrudeSepsis.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  SIRS1CrudeSepsis.Pred.roc and SOFA1CrudeSepsis.Pred.roc
## Z = -19.427, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.6502231   0.6796153
roc.test(SOFA1CrudeSepsis.Pred.roc,qSOFA1CrudeSepsis.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  SOFA1CrudeSepsis.Pred.roc and qSOFA1CrudeSepsis.Pred.roc
## Z = 34.588, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.6796153   0.6368558
roc.test(qSOFA2CrudeSepsis.Pred.roc,SIRS2CrudeSepsis.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  qSOFA2CrudeSepsis.Pred.roc and SIRS2CrudeSepsis.Pred.roc
## Z = 11.434, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.5928223   0.5805731
roc.test(SOFA2CrudeSepsis.Pred.roc,SIRS2CrudeSepsis.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  SOFA2CrudeSepsis.Pred.roc and SIRS2CrudeSepsis.Pred.roc
## Z = 24.43, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.6087716   0.5805731
roc.test(FuzzyLogicCrudeSepsis.Pred.roc,SIRS2CrudeSepsis.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  FuzzyLogicCrudeSepsis.Pred.roc and SIRS2CrudeSepsis.Pred.roc
## Z = 83.266, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.6665731   0.5805731
roc.test(FuzzyLogicCrudeSepsis.Pred.roc,qSOFA2CrudeSepsis.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  FuzzyLogicCrudeSepsis.Pred.roc and qSOFA2CrudeSepsis.Pred.roc
## Z = 61.41, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.6665731   0.5928223
roc.test(FuzzyLogicCrudeSepsis.Pred.roc,SOFA2CrudeSepsis.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  FuzzyLogicCrudeSepsis.Pred.roc and SOFA2CrudeSepsis.Pred.roc
## Z = 49.06, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.6665731   0.6087716
roc.test(SOFA2CrudeSepsis.Pred.roc,qSOFA2CrudeSepsis.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  SOFA2CrudeSepsis.Pred.roc and qSOFA2CrudeSepsis.Pred.roc
## Z = 14.701, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.6087716   0.5928223
roc.test(SIRS2ADJSepsis.Pred.roc,SIRS2CrudeSepsis.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  SIRS2ADJSepsis.Pred.roc and SIRS2CrudeSepsis.Pred.roc
## Z = 145.5, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.7303764   0.5805731
roc.test(SOFA2ADJSepsis.Pred.roc,SOFA2CrudeSepsis.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  SOFA2ADJSepsis.Pred.roc and SOFA2CrudeSepsis.Pred.roc
## Z = 134.85, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.7398636   0.6087716
roc.test(FuzzyLogicADJSepsis.Pred.roc,FuzzyLogicCrudeSepsis.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  FuzzyLogicADJSepsis.Pred.roc and FuzzyLogicCrudeSepsis.Pred.roc
## Z = 124.58, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.7706897   0.6665731
roc.test(FuzzyLogicCrudeSepsis.Pred.roc,qSOFA2CrudeSepsis.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  FuzzyLogicCrudeSepsis.Pred.roc and qSOFA2CrudeSepsis.Pred.roc
## Z = 61.41, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.6665731   0.5928223
roc.test(FuzzyLogicCrudeSepsis.Pred.roc,SOFA2CrudeSepsis.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  FuzzyLogicCrudeSepsis.Pred.roc and SOFA2CrudeSepsis.Pred.roc
## Z = 49.06, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.6665731   0.6087716
roc.test(SOFA2CrudeSepsis.Pred.roc,qSOFA2CrudeSepsis.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  SOFA2CrudeSepsis.Pred.roc and qSOFA2CrudeSepsis.Pred.roc
## Z = 14.701, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.6087716   0.5928223
roc.test(SIRS1ADJMort.Pred.roc,qSOFA1ADJMort.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  SIRS1ADJMort.Pred.roc and qSOFA1ADJMort.Pred.roc
## Z = 3.0026, p-value = 0.002677
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.7814890   0.7777231
roc.test(SIRS1ADJMort.Pred.roc,SOFA1ADJMort.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  SIRS1ADJMort.Pred.roc and SOFA1ADJMort.Pred.roc
## Z = -46.605, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.7814890   0.8472926
roc.test(SOFA1ADJMort.Pred.roc,qSOFA1ADJMort.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  SOFA1ADJMort.Pred.roc and qSOFA1ADJMort.Pred.roc
## Z = 55.425, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.8472926   0.7777231
roc.test(qSOFA2ADJMort.Pred.roc,SIRS2ADJMort.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  qSOFA2ADJMort.Pred.roc and SIRS2ADJMort.Pred.roc
## Z = 7.8843, p-value = 3.163e-15
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.7505584   0.7423965
roc.test(SOFA2ADJMort.Pred.roc,SIRS2ADJMort.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  SOFA2ADJMort.Pred.roc and SIRS2ADJMort.Pred.roc
## Z = 14.999, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.7592311   0.7423965
roc.test(FuzzyLogicADJMort.Pred.roc,SIRS2ADJMort.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  FuzzyLogicADJMort.Pred.roc and SIRS2ADJMort.Pred.roc
## Z = 30.923, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.7767738   0.7423965
roc.test(FuzzyLogicADJMort.Pred.roc,qSOFA2ADJMort.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  FuzzyLogicADJMort.Pred.roc and qSOFA2ADJMort.Pred.roc
## Z = 21.591, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.7767738   0.7505584
roc.test(FuzzyLogicADJMort.Pred.roc,SOFA2ADJMort.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  FuzzyLogicADJMort.Pred.roc and SOFA2ADJMort.Pred.roc
## Z = 14.737, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.7767738   0.7592311
roc.test(SOFA2ADJMort.Pred.roc,qSOFA2ADJMort.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  SOFA2ADJMort.Pred.roc and qSOFA2ADJMort.Pred.roc
## Z = 8.3814, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.7592311   0.7505584
roc.test(SIRS1CrudeMort.Pred.roc,qSOFA1CrudeMort.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  SIRS1CrudeMort.Pred.roc and qSOFA1CrudeMort.Pred.roc
## Z = -6.7101, p-value = 1.945e-11
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.6959156   0.7080340
roc.test(SIRS1CrudeMort.Pred.roc,SOFA1CrudeMort.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  SIRS1CrudeMort.Pred.roc and SOFA1CrudeMort.Pred.roc
## Z = -58.592, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.6959156   0.8037549
roc.test(SOFA1CrudeMort.Pred.roc,qSOFA1CrudeMort.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  SOFA1CrudeMort.Pred.roc and qSOFA1CrudeMort.Pred.roc
## Z = 61.582, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.8037549   0.7080340
roc.test(qSOFA2CrudeMort.Pred.roc,SIRS2CrudeMort.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  qSOFA2CrudeMort.Pred.roc and SIRS2CrudeMort.Pred.roc
## Z = 30.418, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.6290462   0.5932939
roc.test(SOFA2CrudeMort.Pred.roc,SIRS2CrudeMort.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  SOFA2CrudeMort.Pred.roc and SIRS2CrudeMort.Pred.roc
## Z = 39.722, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.6407420   0.5932939
roc.test(FuzzyLogicCrudeMort.Pred.roc,SIRS2CrudeMort.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  FuzzyLogicCrudeMort.Pred.roc and SIRS2CrudeMort.Pred.roc
## Z = 65.688, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.6734078   0.5932939
roc.test(FuzzyLogicCrudeMort.Pred.roc,qSOFA2CrudeMort.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  FuzzyLogicCrudeMort.Pred.roc and qSOFA2CrudeMort.Pred.roc
## Z = 31.809, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.6734078   0.6290462
roc.test(FuzzyLogicCrudeMort.Pred.roc,SOFA2CrudeMort.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  FuzzyLogicCrudeMort.Pred.roc and SOFA2CrudeMort.Pred.roc
## Z = 24.679, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.6734078   0.6407420
roc.test(SOFA2CrudeMort.Pred.roc,qSOFA2CrudeMort.Pred.roc)
## 
##  DeLong's test for two correlated ROC curves
## 
## data:  SOFA2CrudeMort.Pred.roc and qSOFA2CrudeMort.Pred.roc
## Z = 10.147, p-value < 2.2e-16
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.6407420   0.6290462

29 Table 3 Mortality Outcome

options(dplyr.width=Inf)
SIRSmortality_Table3 <- ssd_incl_te %>% group_by(BaselineDec, SIRS_Positive) %>% summarise(n=n(),nMortality=sum(hospital_mortality_ultimate), propMortality=mean(hospital_mortality_ultimate), Oddsmortality=propMortality/(1-propMortality))
options(dplyr.width=Inf)
SIRSmortality_Table3 %>% filter(!SIRS_Positive) %>% rename(lt2SIRS=SIRS_Positive) %>% inner_join(SIRSmortality_Table3 %>% filter(SIRS_Positive) %>% rename(gt2SIRS=SIRS_Positive),by="BaselineDec")%>%mutate(Ratio=propMortality.y/propMortality.x)%>%knitr::kable()
BaselineDec lt2SIRS n.x nMortality.x propMortality.x Oddsmortality.x gt2SIRS n.y nMortality.y propMortality.y Oddsmortality.y Ratio
[0.00359,0.0284) FALSE 6003 20 0.0033317 0.0033428 TRUE 21380 509 0.0238073 0.0243879 7.145760
[0.02839,0.0400) FALSE 6581 35 0.0053183 0.0053468 TRUE 20806 833 0.0400365 0.0417063 7.528011
[0.03996,0.0516) FALSE 6745 68 0.0100815 0.0101842 TRUE 20613 1065 0.0516664 0.0544813 5.124853
[0.05164,0.0644) FALSE 7113 95 0.0133558 0.0135366 TRUE 20260 1477 0.0729023 0.0786349 5.458462
[0.06437,0.0788) FALSE 7438 132 0.0177467 0.0180673 TRUE 19939 1729 0.0867145 0.0949478 4.886229
[0.07885,0.0956) FALSE 7196 171 0.0237632 0.0243416 TRUE 20195 2273 0.1125526 0.1268274 4.736425
[0.09557,0.1154) FALSE 7021 213 0.0303376 0.0312867 TRUE 20338 2675 0.1315272 0.1514465 4.335457
[0.11543,0.1411) FALSE 6392 272 0.0425532 0.0444444 TRUE 20983 3445 0.1641805 0.1964306 3.858242
[0.14115,0.1821) FALSE 5831 352 0.0603670 0.0642453 TRUE 21544 4145 0.1923970 0.2382321 3.187121
[0.18207,0.7473] FALSE 4899 434 0.0885895 0.0972004 TRUE 22475 5922 0.2634928 0.3577599 2.974311
qSOFAmortality_Table3 <- ssd_incl_te %>% group_by(BaselineDec, qSOFA_Positive) %>% summarise(n=n(),nMortality=sum(hospital_mortality_ultimate), propMortality=mean(hospital_mortality_ultimate), Oddsmortality=propMortality/(1-propMortality))
options(dplyr.width=Inf)
qSOFAmortality_Table3 %>% filter(!qSOFA_Positive) %>% rename(lt2qSOFA=qSOFA_Positive) %>% inner_join(qSOFAmortality_Table3 %>% filter(qSOFA_Positive) %>% rename(gt2qSOFA=qSOFA_Positive),by="BaselineDec")%>%mutate(Ratio=propMortality.y/propMortality.x)%>%knitr::kable()
BaselineDec lt2qSOFA n.x nMortality.x propMortality.x Oddsmortality.x gt2qSOFA n.y nMortality.y propMortality.y Oddsmortality.y Ratio
[0.00359,0.0284) FALSE 11150 54 0.0048430 0.0048666 TRUE 16233 475 0.0292614 0.0301434 6.041933
[0.02839,0.0400) FALSE 10438 86 0.0082391 0.0083076 TRUE 16949 782 0.0461384 0.0483701 5.599916
[0.03996,0.0516) FALSE 10215 121 0.0118453 0.0119873 TRUE 17143 1012 0.0590328 0.0627363 4.983640
[0.05164,0.0644) FALSE 10130 148 0.0146101 0.0148267 TRUE 17243 1424 0.0825842 0.0900183 5.652556
[0.06437,0.0788) FALSE 9842 198 0.0201179 0.0205309 TRUE 17535 1663 0.0948389 0.1047757 4.714164
[0.07885,0.0956) FALSE 9242 259 0.0280242 0.0288322 TRUE 18149 2185 0.1203923 0.1368705 4.296007
[0.09557,0.1154) FALSE 8586 300 0.0349406 0.0362056 TRUE 18773 2588 0.1378576 0.1599011 3.945483
[0.11543,0.1411) FALSE 7737 351 0.0453664 0.0475223 TRUE 19638 3366 0.1714024 0.2068584 3.778177
[0.14115,0.1821) FALSE 6724 393 0.0584474 0.0620755 TRUE 20651 4104 0.1987313 0.2480208 3.400176
[0.18207,0.7473] FALSE 5622 519 0.0923159 0.1017049 TRUE 21752 5837 0.2683431 0.3667609 2.906792
SOFAmortality_Table3 <- ssd_incl_te %>% group_by(BaselineDec, SOFA_Positive) %>% summarise(n=n(),nMortality=sum(hospital_mortality_ultimate), propMortality=mean(hospital_mortality_ultimate), Oddsmortality=propMortality/(1-propMortality))
options(dplyr.width=Inf)
SOFAmortality_Table3 %>% filter(!SOFA_Positive) %>% rename(lt2SOFA=SOFA_Positive) %>% inner_join(SOFAmortality_Table3 %>% filter(SOFA_Positive) %>% rename(gt2SOFA=SOFA_Positive),by="BaselineDec")%>%mutate(Ratio=propMortality.y/propMortality.x)%>%knitr::kable()
BaselineDec lt2SOFA n.x nMortality.x propMortality.x Oddsmortality.x gt2SOFA n.y nMortality.y propMortality.y Oddsmortality.y Ratio
[0.00359,0.0284) FALSE 12149 21 0.0017285 0.0017315 TRUE 15234 508 0.0333465 0.0344968 19.291722
[0.02839,0.0400) FALSE 10095 31 0.0030708 0.0030803 TRUE 17292 837 0.0484039 0.0508660 15.762491
[0.03996,0.0516) FALSE 9963 48 0.0048178 0.0048411 TRUE 17395 1085 0.0623742 0.0665236 12.946554
[0.05164,0.0644) FALSE 9901 66 0.0066660 0.0067107 TRUE 17472 1506 0.0861951 0.0943254 12.930564
[0.06437,0.0788) FALSE 9577 119 0.0124256 0.0125819 TRUE 17800 1742 0.0978652 0.1084818 7.876090
[0.07885,0.0956) FALSE 8554 156 0.0182371 0.0185759 TRUE 18837 2288 0.1214631 0.1382561 6.660225
[0.09557,0.1154) FALSE 7782 158 0.0203033 0.0207240 TRUE 19577 2730 0.1394494 0.1620467 6.868322
[0.11543,0.1411) FALSE 6785 227 0.0334562 0.0346142 TRUE 20590 3490 0.1694998 0.2040936 5.066325
[0.14115,0.1821) FALSE 5856 254 0.0433743 0.0453409 TRUE 21519 4243 0.1971746 0.2456008 4.545884
[0.18207,0.7473] FALSE 4609 384 0.0833153 0.0908876 TRUE 22765 5972 0.2623325 0.3556244 3.148674
FuzzyLogicmortality_Table3 <- ssd_incl_te %>% group_by(BaselineDec, SepsisFuzzyLogicPositive) %>% summarise(n=n(),nMortality=sum(hospital_mortality_ultimate), propMortality=mean(hospital_mortality_ultimate), Oddsmortality=propMortality/(1-propMortality))
options(dplyr.width=Inf)
FuzzyLogicmortality_Table3 %>% filter(!SepsisFuzzyLogicPositive) %>% rename(lt2FuzzyLogic=SepsisFuzzyLogicPositive) %>% inner_join(FuzzyLogicmortality_Table3 %>% filter(SepsisFuzzyLogicPositive) %>% rename(gt2FuzzyLogic=SepsisFuzzyLogicPositive),by="BaselineDec")%>%mutate(Ratio=propMortality.y/propMortality.x)%>%knitr::kable()
BaselineDec lt2FuzzyLogic n.x nMortality.x propMortality.x Oddsmortality.x gt2FuzzyLogic n.y nMortality.y propMortality.y Oddsmortality.y Ratio
[0.00359,0.0284) FALSE 13638 51 0.0037396 0.0037536 TRUE 13745 478 0.0347763 0.0360292 9.299587
[0.02839,0.0400) FALSE 13374 91 0.0068042 0.0068509 TRUE 14013 777 0.0554485 0.0587035 8.149103
[0.03996,0.0516) FALSE 13338 129 0.0096716 0.0097661 TRUE 14020 1004 0.0716120 0.0771358 7.404346
[0.05164,0.0644) FALSE 13377 199 0.0148763 0.0151009 TRUE 13996 1373 0.0980995 0.1087697 6.594354
[0.06437,0.0788) FALSE 13568 272 0.0200472 0.0204573 TRUE 13809 1589 0.1150699 0.1300327 5.739956
[0.07885,0.0956) FALSE 12865 351 0.0272833 0.0280486 TRUE 14526 2093 0.1440865 0.1683423 5.281118
[0.09557,0.1154) FALSE 12301 408 0.0331680 0.0343059 TRUE 15058 2480 0.1646965 0.1971697 4.965519
[0.11543,0.1411) FALSE 11311 541 0.0478295 0.0502321 TRUE 16064 3176 0.1977092 0.2464308 4.133620
[0.14115,0.1821) FALSE 10409 617 0.0592756 0.0630106 TRUE 16966 3880 0.2286927 0.2965001 3.858123
[0.18207,0.7473] FALSE 8749 833 0.0952109 0.1052299 TRUE 18625 5523 0.2965369 0.4215387 3.114528

30 Table 3 Sepsis Outcome

SIRSsepsis_Table3 <- ssd_incl_te %>% group_by(BaselineDec, SIRS_Positive) %>% summarise(n=n(),nsepsis=sum(sepsis_outcome), propsepsis=mean(sepsis_outcome),Oddssepsis=propsepsis/(1-propsepsis))
options(dplyr.width=Inf)
SIRSsepsis_Table3 %>% filter(!SIRS_Positive) %>% rename(lt2SIRS=SIRS_Positive) %>% inner_join(SIRSsepsis_Table3 %>% filter(SIRS_Positive) %>% rename(gt2SIRS=SIRS_Positive),by="BaselineDec")%>%mutate(Ratio=propsepsis.y/propsepsis.x)%>%knitr::kable()
BaselineDec lt2SIRS n.x nsepsis.x propsepsis.x Oddssepsis.x gt2SIRS n.y nsepsis.y propsepsis.y Oddssepsis.y Ratio
[0.00359,0.0284) FALSE 6003 152 0.0253207 0.0259785 TRUE 21380 1679 0.0785313 0.0852241 3.101471
[0.02839,0.0400) FALSE 6581 274 0.0416350 0.0434438 TRUE 20806 2392 0.1149668 0.1299012 2.761302
[0.03996,0.0516) FALSE 6745 398 0.0590067 0.0627068 TRUE 20613 3148 0.1527192 0.1802462 2.588168
[0.05164,0.0644) FALSE 7113 523 0.0735273 0.0793627 TRUE 20260 3960 0.1954590 0.2429448 2.658318
[0.06437,0.0788) FALSE 7438 635 0.0853724 0.0933412 TRUE 19939 4663 0.2338633 0.3052501 2.739331
[0.07885,0.0956) FALSE 7196 711 0.0988049 0.1096376 TRUE 20195 5426 0.2686804 0.3673912 2.719302
[0.09557,0.1154) FALSE 7021 834 0.1187865 0.1347988 TRUE 20338 6019 0.2959485 0.4203506 2.491432
[0.11543,0.1411) FALSE 6392 820 0.1282854 0.1471644 TRUE 20983 6694 0.3190202 0.4684723 2.486801
[0.14115,0.1821) FALSE 5831 852 0.1461156 0.1711187 TRUE 21544 7450 0.3458039 0.5285937 2.366646
[0.18207,0.7473] FALSE 4899 1001 0.2043274 0.2567984 TRUE 22475 8625 0.3837597 0.6227437 1.878161
qSOFAsepsis_Table3 <- ssd_incl_te %>% group_by(BaselineDec, qSOFA_Positive) %>% summarise(n=n(),nsepsis=sum(sepsis_outcome), propsepsis=mean(sepsis_outcome), Oddssepsis=propsepsis/(1-propsepsis))
options(dplyr.width=Inf)
qSOFAsepsis_Table3 %>% filter(!qSOFA_Positive) %>% rename(lt2qSOFA=qSOFA_Positive) %>% inner_join(qSOFAsepsis_Table3 %>% filter(qSOFA_Positive) %>% rename(gt2qSOFA=qSOFA_Positive),by="BaselineDec")%>%mutate(Ratio=propsepsis.y/propsepsis.x)%>%knitr::kable()
BaselineDec lt2qSOFA n.x nsepsis.x propsepsis.x Oddssepsis.x gt2qSOFA n.y nsepsis.y propsepsis.y Oddssepsis.y Ratio
[0.00359,0.0284) FALSE 11150 497 0.0445740 0.0466535 TRUE 16233 1334 0.0821783 0.0895362 1.843637
[0.02839,0.0400) FALSE 10438 675 0.0646676 0.0691386 TRUE 16949 1991 0.1174701 0.1331060 1.816522
[0.03996,0.0516) FALSE 10215 858 0.0839941 0.0916961 TRUE 17143 2688 0.1567987 0.1859564 1.866782
[0.05164,0.0644) FALSE 10130 990 0.0977295 0.1083151 TRUE 17243 3493 0.2025750 0.2540364 2.072812
[0.06437,0.0788) FALSE 9842 1096 0.1113595 0.1253144 TRUE 17535 4202 0.2396350 0.3151579 2.151905
[0.07885,0.0956) FALSE 9242 1208 0.1307076 0.1503610 TRUE 18149 4929 0.2715852 0.3728442 2.077807
[0.09557,0.1154) FALSE 8586 1268 0.1476823 0.1732714 TRUE 18773 5585 0.2975017 0.4234911 2.014471
[0.11543,0.1411) FALSE 7737 1205 0.1557451 0.1844764 TRUE 19638 6309 0.3212649 0.4733288 2.062761
[0.14115,0.1821) FALSE 6724 1125 0.1673111 0.2009287 TRUE 20651 7177 0.3475376 0.5326555 2.077194
[0.18207,0.7473] FALSE 5622 1211 0.2154038 0.2745409 TRUE 21752 8415 0.3868610 0.6309515 1.795980
SOFAsepsis_Table3 <- ssd_incl_te %>% group_by(BaselineDec, SOFA_Positive) %>% summarise(n=n(),nsepsis=sum(sepsis_outcome), propsepsis=mean(sepsis_outcome), Oddssepsis=propsepsis/(1-propsepsis))
options(dplyr.width=Inf)
SOFAsepsis_Table3 %>% filter(!SOFA_Positive) %>% rename(lt2SOFA=SOFA_Positive) %>% inner_join(SOFAsepsis_Table3 %>% filter(SOFA_Positive) %>% rename(gt2SOFA=SOFA_Positive),by="BaselineDec")%>%mutate(Ratio=propsepsis.y/propsepsis.x)%>%knitr::kable()
BaselineDec lt2SOFA n.x nsepsis.x propsepsis.x Oddssepsis.x gt2SOFA n.y nsepsis.y propsepsis.y Oddssepsis.y Ratio
[0.00359,0.0284) FALSE 12149 445 0.0366285 0.0380212 TRUE 15234 1386 0.0909807 0.1000867 2.483875
[0.02839,0.0400) FALSE 10095 533 0.0527984 0.0557415 TRUE 17292 2133 0.1233518 0.1407085 2.336279
[0.03996,0.0516) FALSE 9963 742 0.0744756 0.0804685 TRUE 17395 2804 0.1611957 0.1921733 2.164411
[0.05164,0.0644) FALSE 9901 741 0.0748409 0.0808952 TRUE 17472 3742 0.2141712 0.2725419 2.861686
[0.06437,0.0788) FALSE 9577 854 0.0891720 0.0979021 TRUE 17800 4444 0.2496629 0.3327344 2.799791
[0.07885,0.0956) FALSE 8554 866 0.1012392 0.1126431 TRUE 18837 5271 0.2798216 0.3885449 2.763966
[0.09557,0.1154) FALSE 7782 922 0.1184785 0.1344023 TRUE 19577 5931 0.3029576 0.4346329 2.557067
[0.11543,0.1411) FALSE 6785 916 0.1350037 0.1560743 TRUE 20590 6598 0.3204468 0.4715552 2.373615
[0.14115,0.1821) FALSE 5856 898 0.1533470 0.1811214 TRUE 21519 7404 0.3440680 0.5245484 2.243722
[0.18207,0.7473] FALSE 4609 883 0.1915817 0.2369834 TRUE 22765 8743 0.3840545 0.6235202 2.004651
FuzzyLogicsepsis_Table3 <- ssd_incl_te %>% group_by(BaselineDec, SepsisFuzzyLogicPositive) %>% summarise(n=n(),nsepsis=sum(sepsis_outcome), propsepsis=mean(sepsis_outcome), Oddssepsis=propsepsis/(1-propsepsis))
FuzzyLogicsepsis_Table3 %>% filter(!SepsisFuzzyLogicPositive) %>% rename(lt2FuzzyLogic=SepsisFuzzyLogicPositive) %>% inner_join(FuzzyLogicsepsis_Table3 %>% filter(SepsisFuzzyLogicPositive) %>% rename(gt2FuzzyLogic=SepsisFuzzyLogicPositive),by="BaselineDec")%>%mutate (Ratio=propsepsis.y/propsepsis.x)%>%knitr::kable()
BaselineDec lt2FuzzyLogic n.x nsepsis.x propsepsis.x Oddssepsis.x gt2FuzzyLogic n.y nsepsis.y propsepsis.y Oddssepsis.y Ratio
[0.00359,0.0284) FALSE 13638 395 0.0289632 0.0298271 TRUE 13745 1436 0.1044744 0.1166626 3.607142
[0.02839,0.0400) FALSE 13374 542 0.0405264 0.0422382 TRUE 14013 2124 0.1515735 0.1786525 3.740119
[0.03996,0.0516) FALSE 13338 719 0.0539061 0.0569776 TRUE 14020 2827 0.2016405 0.2525686 3.740586
[0.05164,0.0644) FALSE 13377 899 0.0672049 0.0720468 TRUE 13996 3584 0.2560732 0.3442182 3.810335
[0.06437,0.0788) FALSE 13568 1054 0.0776828 0.0842257 TRUE 13809 4244 0.3073358 0.4437010 3.956292
[0.07885,0.0956) FALSE 12865 1130 0.0878352 0.0962931 TRUE 14526 5007 0.3446923 0.5260006 3.924306
[0.09557,0.1154) FALSE 12301 1324 0.1076335 0.1206158 TRUE 15058 5529 0.3671802 0.5802288 3.411393
[0.11543,0.1411) FALSE 11311 1351 0.1194413 0.1356426 TRUE 16064 6163 0.3836529 0.6224624 3.212064
[0.14115,0.1821) FALSE 10409 1397 0.1342108 0.1550155 TRUE 16966 6905 0.4069905 0.6863135 3.032472
[0.18207,0.7473] FALSE 8749 1561 0.1784204 0.2171675 TRUE 18625 8065 0.4330201 0.7637311 2.426966
options(dplyr.width=Inf)

ORSIRSmort_Table3 <-SIRSmortality_Table3%>%filter(!SIRS_Positive) %>% rename(lt2SIRS=SIRS_Positive) %>% inner_join(SIRSmortality_Table3 %>% filter(SIRS_Positive) %>% rename(gt2SIRS=SIRS_Positive), by="BaselineDec") %>%mutate(OddsRatio=Oddsmortality.y/Oddsmortality.x)%>%mutate(a=nMortality.x, b=nMortality.y, c=n.x, d=n.y, se=sqrt(1/a+1/b+1/c+1/d),LL=exp(log(OddsRatio)-qnorm(0.995)*se), UL=exp(log(OddsRatio)+qnorm(0.995)*se))%>%mutate(type="SIRS")


ORqSOFAmort_Table3 <-qSOFAmortality_Table3%>%filter(!qSOFA_Positive) %>% rename(lt2qSOFA=qSOFA_Positive) %>% inner_join(qSOFAmortality_Table3 %>% filter(qSOFA_Positive) %>% rename(gt2qSOFA=qSOFA_Positive), by="BaselineDec") %>%mutate(OddsRatio=Oddsmortality.y/Oddsmortality.x)%>%mutate(a=nMortality.x, b=nMortality.y, c=n.x, d=n.y, se=sqrt(1/a+1/b+1/c+1/d),LL=exp(log(OddsRatio)-qnorm(0.995)*se), UL=exp(log(OddsRatio)+qnorm(0.995)*se))%>%mutate(type="qSOFA")


ORSOFAmort_Table3 <-SOFAmortality_Table3%>%filter(!SOFA_Positive) %>% rename(lt2SOFA=SOFA_Positive) %>% inner_join(SOFAmortality_Table3 %>% filter(SOFA_Positive) %>% rename(gt2SOFA=SOFA_Positive), by="BaselineDec") %>%mutate(OddsRatio=Oddsmortality.y/Oddsmortality.x)%>%mutate(a=nMortality.x, b=nMortality.y, c=n.x, d=n.y, se=sqrt(1/a+1/b+1/c+1/d),LL=exp(log(OddsRatio)-qnorm(0.995)*se), UL=exp(log(OddsRatio)+qnorm(0.995)*se))%>%mutate(type="SOFA")


ORFuzzyLogicmort_Table3 <- FuzzyLogicmortality_Table3%>% filter(!SepsisFuzzyLogicPositive) %>% rename(lt2FuzzyLogic=SepsisFuzzyLogicPositive) %>% inner_join(FuzzyLogicmortality_Table3 %>% filter(SepsisFuzzyLogicPositive) %>% rename(gt2FuzzyLogic=SepsisFuzzyLogicPositive),by="BaselineDec")%>%mutate(OddsRatio=Oddsmortality.y/Oddsmortality.x)%>%mutate(a=nMortality.x,b=nMortality.y, c=n.x-a, d=n.y,se=sqrt(1/a +1/b+1/c+1/d),LL=exp (log(OddsRatio)- qnorm(0.995)*se), UL=exp(log(OddsRatio)+qnorm(0.995)*se))%>%mutate(type="Fuzzy Logic")


ORSIRSsepsis_Table3 <-SIRSsepsis_Table3%>%filter(!SIRS_Positive) %>% rename(lt2SIRS=SIRS_Positive) %>% inner_join(SIRSsepsis_Table3 %>% filter(SIRS_Positive) %>% rename(gt2SIRS=SIRS_Positive), by="BaselineDec") %>%mutate(OddsRatio=Oddssepsis.y/Oddssepsis.x)%>%mutate(a=nsepsis.x, b=nsepsis.y, c=n.x, d=n.y, se=sqrt(1/a+1/b+1/c+1/d),LL=exp(log(OddsRatio)-qnorm(0.995)*se), UL=exp(log(OddsRatio)+qnorm(0.995)*se))%>%mutate(type="SIRS")


ORqSOFAsepsis_Table3 <-qSOFAsepsis_Table3%>%filter(!qSOFA_Positive) %>% rename(lt2qSOFA=qSOFA_Positive) %>% inner_join(qSOFAsepsis_Table3 %>% filter(qSOFA_Positive) %>% rename(gt2qSOFA=qSOFA_Positive), by="BaselineDec") %>%mutate(OddsRatio=Oddssepsis.y/Oddssepsis.x)%>%mutate(a=nsepsis.x, b=nsepsis.y, c=n.x, d=n.y, se=sqrt(1/a+1/b+1/c+1/d),LL=exp(log(OddsRatio)-qnorm(0.995)*se), UL=exp(log(OddsRatio)+qnorm(0.995)*se))%>%mutate(type="qSOFA")


ORSOFAsepsis_Table3 <-SOFAsepsis_Table3%>%filter(!SOFA_Positive) %>% rename(lt2SOFA=SOFA_Positive) %>% inner_join(SOFAsepsis_Table3 %>% filter(SOFA_Positive) %>% rename(gt2SOFA=SOFA_Positive), by="BaselineDec") %>%mutate(OddsRatio=Oddssepsis.y/Oddssepsis.x)%>%mutate(a=nsepsis.x, b=nsepsis.y, c=n.x, d=n.y, se=sqrt(1/a+1/b+1/c+1/d),LL=exp(log(OddsRatio)-qnorm(0.995)*se), UL=exp(log(OddsRatio)+qnorm(0.995)*se))%>%mutate(type="SOFA")


ORFuzzyLogicsepsis_Table3 <- FuzzyLogicsepsis_Table3%>% filter(!SepsisFuzzyLogicPositive) %>% rename(lt2FuzzyLogic=SepsisFuzzyLogicPositive) %>% inner_join(FuzzyLogicsepsis_Table3 %>% filter(SepsisFuzzyLogicPositive) %>% rename(gt2FuzzyLogic=SepsisFuzzyLogicPositive),by="BaselineDec")%>%mutate(OddsRatio=Oddssepsis.y/Oddssepsis.x)%>%mutate(a=nsepsis.x,b=nsepsis.y, c=n.x-a, d=n.y,se=sqrt(1/a +1/b+1/c+1/d),LL=exp (log(OddsRatio)- qnorm(0.995)*se), UL=exp(log(OddsRatio)+qnorm(0.995)*se))%>%mutate(type="Fuzzy Logic")

31 Plots for Table 3

library(ggplot2)

levels(ORFuzzyLogicsepsis_Table3$BaselineDec)<-seq(1,10)
levels(ORSOFAsepsis_Table3$BaselineDec)<-seq(1,10)
levels(ORqSOFAsepsis_Table3$BaselineDec)<-seq(1,10)
levels(ORSIRSsepsis_Table3$BaselineDec)<-seq(1,10)

ORTable3<-ORFuzzyLogicsepsis_Table3%>%bind_rows(ORSOFAsepsis_Table3)%>%bind_rows(ORqSOFAsepsis_Table3)%>%bind_rows(ORSIRSsepsis_Table3)

postscript(file="deciles_sepsis_nolog_orig.eps")
ggplot(ORTable3,aes(BaselineDec,OddsRatio, group=type,col=type))+geom_point(aes(shape=type),size=3,position = position_dodge(width = 0.5))+geom_errorbar(aes(ymax=UL, ymin=LL),width=0.3,position = position_dodge(width = 0.5))+xlab("Baseline Sepsis Deciles")+ylab("Odds Ratio")+  theme(legend.title=element_blank()) + theme(axis.title=element_text(size=16,face="bold"),legend.text=element_text(size=12)) +ggtitle("Outcome: Sepsis") + scale_shape_manual(values=c(15, 16, 17,4))
dev.off()
## png 
##   2
ggplot(ORTable3,aes(BaselineDec,OddsRatio, group=type,col=type))+geom_point(aes(shape=type),size=3,position = position_dodge(width = 0.5))+geom_errorbar(aes(ymax=UL, ymin=LL),width=0.3,position = position_dodge(width = 0.5))+xlab("Baseline Sepsis Deciles")+ylab("Odds Ratio")+  theme(legend.title=element_blank())+ theme(axis.title=element_text(size=16,face="bold"),legend.text=element_text(size=12)) +ggtitle("Outcome: Sepsis") + scale_shape_manual(values=c(15, 16, 17,4))

postscript(file="deciles_sepsis_nolog_newsize.eps")
ggplot(ORTable3,aes(BaselineDec,OddsRatio, group=type,col=type))+geom_point(position = position_dodge(width = 0.5))+geom_errorbar(aes(ymax=UL, ymin=LL),width=0.3,position = position_dodge(width = 0.5))+xlab("Baseline Sepsis Deciles")+ylab("Odds Ratio")+ggtitle("Outcome: Sepsis") + theme(axis.title=element_text(size=16,face="bold"),legend.text=element_text(size=12)) + scale_shape_manual(values=c(15, 16, 17,4))
dev.off()
## png 
##   2
ggplot(ORTable3,aes(BaselineDec,OddsRatio, group=type,col=type))+geom_point(aes(shape=type),size=3,position = position_dodge(width = 0.5))+geom_errorbar(aes(ymax=UL, ymin=LL),width=0.3,position = position_dodge(width = 0.5))+xlab("Baseline Sepsis Deciles")+ylab("Odds Ratio")+  theme(legend.title=element_blank())+ theme(axis.title=element_text(size=16,face="bold"),legend.text=element_text(size=12)) +ggtitle("Outcome: Sepsis")  + scale_shape_manual(values=c(15, 16, 17,4))

postscript(file="deciles_sepsis_nolog_orig.eps")
ggplot(ORTable3,aes(BaselineDec,OddsRatio, group=type,col=type))+geom_point(aes(shape=type),size=3,position = position_dodge(width = 0.5))+geom_errorbar(aes(ymax=UL, ymin=LL),width=0.3,position = position_dodge(width = 0.5))+xlab("Baseline Sepsis Deciles")+ylab("Odds Ratio")+  theme(legend.title=element_blank())+ theme(axis.title=element_text(size=16,face="bold"),legend.text=element_text(size=12)) + ggtitle("Outcome: Sepsis") +  scale_y_log10() + scale_shape_manual(values=c(15, 16, 17,4))
dev.off()
## png 
##   2
ggplot(ORTable3,aes(BaselineDec,OddsRatio, group=type,col=type))+geom_point(aes(shape=type),size=3,position = position_dodge(width = 0.5))+geom_errorbar(aes(ymax=UL, ymin=LL),width=0.3,position = position_dodge(width = 0.5))+xlab("Baseline Sepsis Deciles")+ylab("Odds Ratio")+  theme(legend.title=element_blank())+ theme(axis.title=element_text(size=16,face="bold"),legend.text=element_text(size=12))+ggtitle("Outcome: Sepsis") + scale_shape_manual(values=c(15, 16, 17,4))

postscript(file="deciles_sepsis_nolog_newsize.eps")
ggplot(ORTable3,aes(BaselineDec,OddsRatio, group=type,col=type))+geom_point(aes(shape=type),size=3,position = position_dodge(width = 0.5))+geom_errorbar(aes(ymax=UL, ymin=LL),width=0.3,position = position_dodge(width = 0.5))+xlab("Baseline Sepsis Deciles")+ylab("Odds Ratio")+  theme(legend.title=element_blank())+ theme(axis.title=element_text(size=16,face="bold"),legend.text=element_text(size=12))+ggtitle("Outcome: Sepsis") + theme(axis.title=element_text(size=16,face="bold")) + scale_shape_manual(values=c(15, 16, 17,4))
dev.off()
## png 
##   2
ggplot(ORTable3,aes(BaselineDec,OddsRatio, group=type,col=type))+geom_point(aes(shape=type),size=3,position = position_dodge(width = 0.5))+geom_errorbar(aes(ymax=UL, ymin=LL),width=0.3,position = position_dodge(width = 0.5))+xlab("Baseline Sepsis Deciles")+ylab("Odds Ratio")+  theme(legend.title=element_blank())+ theme(axis.title=element_text(size=16,face="bold"),legend.text=element_text(size=12))+ggtitle("Outcome: Sepsis") + theme(axis.title=element_text(size=16,face="bold")) + scale_y_log10() + scale_shape_manual(values=c(15, 16, 17,4))

levels(ORFuzzyLogicmort_Table3$BaselineDec)<-seq(1,10)
levels(ORSOFAmort_Table3$BaselineDec)<-seq(1,10)
levels(ORqSOFAmort_Table3$BaselineDec)<-seq(1,10)
levels(ORSIRSmort_Table3$BaselineDec)<-seq(1,10)

ORmortTable3<-ORFuzzyLogicmort_Table3%>%bind_rows(ORSOFAmort_Table3)%>%bind_rows(ORqSOFAmort_Table3)%>%bind_rows(ORSIRSmort_Table3)


postscript(file="deciles_mort_nolog_newsize.eps")

ggplot(ORmortTable3,aes(BaselineDec,OddsRatio, group=type,col=type))+geom_point(aes(shape=type),size=3,position = position_dodge(width = 0.5))+geom_errorbar(aes(ymax=UL, ymin=LL),width=0.3,position = position_dodge(width = 0.5))+xlab("Baseline Mortality Deciles")+ylab("Odds Ratio")+  theme(legend.title=element_blank())+ theme(axis.title=element_text(size=16,face="bold"),legend.text=element_text(size=12)) + ggtitle("Outcome: Mortality") + scale_shape_manual(values=c(15, 16, 17,4))
dev.off()
## png 
##   2
ggplot(ORmortTable3,aes(BaselineDec,OddsRatio, group=type,col=type))+geom_point(aes(shape=type),size=3,position = position_dodge(width = 0.5))+geom_errorbar(aes(ymax=UL, ymin=LL),width=0.3,position = position_dodge(width = 0.5))+xlab("Baseline Mortality Deciles")+ylab("Odds Ratio")+  theme(legend.title=element_blank())+ theme(axis.title=element_text(size=16,face="bold"),legend.text=element_text(size=12)) + ggtitle("Outcome: Mortality") + scale_shape_manual(values=c(15, 16, 17,4))

postscript(file="deciles_mort_log_newsize.eps")
ggplot(ORmortTable3,aes(BaselineDec,OddsRatio, group=type,col=type))+geom_point(aes(shape=type),size=3,position = position_dodge(width = 0.5))+geom_errorbar(aes(ymax=UL, ymin=LL),width=0.3,position = position_dodge(width = 0.5))+xlab("Baseline Mortality Deciles")+ylab("Odds Ratio")+  theme(legend.title=element_blank())+ theme(axis.title=element_text(size=16,face="bold"),legend.text=element_text(size=12))+ggtitle("Outcome: Mortality") + scale_y_log10() + scale_shape_manual(values=c(15, 16, 17,4))
dev.off()
## png 
##   2
ggplot(ORmortTable3,aes(BaselineDec,OddsRatio, group=type,col=type))+geom_point(aes(shape=type),size=3,position = position_dodge(width = 0.5))+geom_errorbar(aes(ymax=UL, ymin=LL),width=0.3,position = position_dodge(width = 0.5))+xlab("Baseline Sepsis Deciles")+ylab("Odds Ratio")+  theme(legend.title=element_blank())+ theme(axis.title=element_text(size=16,face="bold"),legend.text=element_text(size=12))+ggtitle("Outcome: Mortality") + scale_y_log10() + scale_shape_manual(values=c(15, 16, 17,4))

32 Plots for Table 2

plot(SOFA2CrudeMort.Perf, main = "Comparison of Positive Scores 
     Mortality Crude Prediction",col="#C77CFF",lty=1,lwd=1.5)
plot(qSOFA2CrudeMort.Perf, add = TRUE, col="#7CAE00", lty=2,lwd=1.5)
plot(SIRS2CrudeMort.Perf, add = TRUE,col="#00BFC4", lty=3,lwd=1.5)
plot(FuzzyLogicCrudeMort.Perf, add=TRUE,col="#F8766D", lty=6,lwd=1.5)
abline(0,1,lty=3)
#legend(.6,.3,lty = c(1,1,1),col=c("black","red","springgreen","blue"),c("SOFA Pos+","qSOFA Pos+","SIRS Pos+","FL/OD Pos+"))
legend(.6,.3,lty = c(1,2,3,6),col=c("#C77CFF","#7CAE00","#00BFC4","#F8766D"),c("SOFA Pos+","qSOFA Pos+","SIRS Pos+","FL/OD Pos+"),lwd=1.5)

plot(SOFA1CrudeMort.Perf, main = "Comparison of Total Scores versus 
     Fuzzy Logic Positive Mortality Crude Prediction",col="#C77CFF",lty=1,lwd=1.5)
plot(qSOFA1CrudeMort.Perf, add = TRUE, col="#7CAE00", lty=2,lwd=1.5)
plot(SIRS1CrudeMort.Perf, add = TRUE,col="#00BFC4", lty=3,lwd=1.5)
plot(FuzzyLogicCrudeMort.Perf, add=TRUE,col="#F8766D", lty=6,lwd=1.5)
abline(0,1,lty=3)
legend(.6,.3,lty = c(1,2,3,6),col=c("#C77CFF","#7CAE00","#00BFC4","#F8766D"),c("SOFA Total","qSOFA Total","SIRS Total", "FL/OD Pos+"),lwd=1.5)

plot(SOFA1CrudeMort.Perf, main = "Comparison of Total Scores 
     Mortality Crude Prediction",col="#C77CFF",lty=1,lwd=1.5)
plot(qSOFA1CrudeMort.Perf, add = TRUE, col="#7CAE00", lty=2,lwd=1.5)
plot(SIRS1CrudeMort.Perf, add = TRUE,col="#00BFC4", lty=3,lwd=1.5)
abline(0,1,lty=3)
legend(.6,.3,lty = c(1,2,3),c("SOFA Total","qSOFA Total","SIRS Total"),lwd=1.5,col=c("#C77CFF","#7CAE00","#00BFC4"))

plot(SOFA2ADJMort.Perf, main = "Comparison of Positive Scores 
     Mortality Adjusted Prediction",col="#C77CFF",lty=1,lwd=1.5)
plot(qSOFA2ADJMort.Perf, add = TRUE,col="#7CAE00",lty=2,lwd=1.5)
plot(SIRS2ADJMort.Perf , add = TRUE,col="#00BFC4", lty=3,lwd=1.5)
plot(FuzzyLogicADJMort.Perf, add=TRUE,col="#F8766D", lty=6,lwd=1.5)
abline(0,1,lty=3)
legend(.6,.3,lty = c(1,1,1),col=c("black","#C77CFF","#00BFC4","#F8766D"),c("SOFA Pos+","qSOFA Pos+","SIRS Pos+","FL/OD Pos+"))

plot(SOFA1ADJMort.Perf, main = "Comparison of Total Scores versus 
     Fuzzy Logic Positive Mortality Adjusted Prediction",col="#C77CFF",lty=1,lwd=1.5)
plot(qSOFA1ADJMort.Perf, add = TRUE, col="#7CAE00", lty=2,lwd=1.5)
plot(SIRS1ADJMort.Perf, add = TRUE,col="#00BFC4", lty=3,lwd=1.5)
plot(FuzzyLogicADJMort.Perf, add=TRUE,col="#F8766D", lty=6,lwd=1.5)
abline(0,1,lty=3)
legend(.6,.3,lty = c(1,2,3,6),col=c("#C77CFF","#7CAE00","#00BFC4","#F8766D"),c("SOFA Total","qSOFA Total","SIRS Total", "FL/OD Pos+"),lwd=1.5)

plot(SOFA1ADJMort.Perf, main = "Comparison of Total Scores 
     Mortality Adjusted Prediction",col="#C77CFF",lty=1,lwd=1.5)
plot(qSOFA1ADJMort.Perf, add = TRUE, col="#7CAE00", lty=2,lwd=1.5)
plot(SIRS1ADJMort.Perf, add = TRUE,col="#00BFC4", lty=3,lwd=1.5)
abline(0,1,lty=3)
legend(.6,.3,lty = c(1,2,3),col=c("#C77CFF","#7CAE00","#00BFC4"),c("SOFA Total","qSOFA Total","SIRS Total"),lwd=1.5)

plot(SOFA2CrudeSepsis.Perf, main = "Comparison of Positive Scores 
     Sepsis Crude Prediction",col="#C77CFF",lty=1,lwd=1.5)
plot(qSOFA2CrudeSepsis.Perf, add = TRUE, col="#7CAE00", lty=2,lwd=1.5)
plot(SIRS2CrudeSepsis.Perf, add = TRUE, col="#00BFC4", lty=3,lwd=1.5)
plot(FuzzyLogicCrudeSepsis.Perf, add=TRUE, col="#F8766D", lty=6,lwd=1.5)
abline(0,1,lty=3)
legend(.6,.3,lty = c(1,2,3,6),col=c("#C77CFF","#7CAE00","#00BFC4","#F8766D"),c("SOFA Pos+","qSOFA Pos+","SIRS Pos+","FL/OD Pos+"),lwd=1.5)

plot(SOFA1CrudeSepsis.Perf, main = "Comparison of Total Scores versus 
     Fuzzy Logic Positive Sepsis Crude Prediction",col="#C77CFF",lty=1,lwd=1.5)
plot(qSOFA1CrudeSepsis.Perf, add = TRUE,col="#7CAE00",lty=2,lwd=1.5)
plot(SIRS1CrudeSepsis.Perf, add = TRUE,col="#00BFC4", lty=3,lwd=1.5)
plot(FuzzyLogicCrudeSepsis.Perf, add=TRUE,col="#F8766D", lty=6,lwd=1.5)
abline(0,1,lty=3)
legend(.6,.3,lty = c(1,2,3,6),col=c("#C77CFF","#7CAE00","#00BFC4", "#F8766D"),c("SOFA Total","qSOFA Total","SIRS Total", "FL/OD Pos+"),lwd=1.5)

plot(SOFA1CrudeSepsis.Perf, main = "Comparison of Total Scores Sepsis Crude Prediction",col="#C77CFF",lty=1,lwd=1.5)
plot(qSOFA1CrudeSepsis.Perf, add = TRUE,col="#7CAE00",lty=2,lwd=1.5)
plot(SIRS1CrudeSepsis.Perf, add = TRUE,col="#00BFC4", lty=3,lwd=1.5)
abline(0,1,lty=3)
legend(.6,.3,lty = c(1,2,3,6),col=c("#C77CFF","#7CAE00","#00BFC4", "#F8766D"),c("SOFA Total","qSOFA Total","SIRS Total"),lwd=1.5)

plot(SOFA2ADJSepsis.Perf, main = "Comparison of Positive Scores 
     Sepsis Adjusted Prediction",col="#C77CFF",lty=1,lwd=1.5)
plot(qSOFA2ADJSepsis.Perf, add = TRUE,col="#7CAE00",lty=2,lwd=1.5)
plot(SIRS2ADJSepsis.Perf, add = TRUE, col="#00BFC4", lty=3,lwd=1.5)
plot(FuzzyLogicADJSepsis.Perf, add=TRUE,col="#F8766D", lty=6,lwd=1.5)
abline(0,1,lty=3)
legend(.6,.3,lty = c(1,2,3,6),col=c("#C77CFF","#7CAE00","#00BFC4", "#F8766D"),c("SOFA Pos+","qSOFA Pos+","SIRS Pos+","FL/OD Pos+"),lwd=1.5)

plot(SOFA1ADJSepsis.Perf, main = "Comparison of Total Scores versus 
     Fuzzy Logic Positive Sepsis Adjusted Prediction",col="#C77CFF",lty=1,lwd=1.5)
plot(qSOFA1ADJSepsis.Perf, add = TRUE,col="#7CAE00",lty=2,lwd=1.5)
plot(SIRS1ADJSepsis.Perf, add = TRUE ,col="#00BFC4", lty=3,lwd=1.5)
plot(FuzzyLogicADJSepsis.Perf, add=TRUE,col="#F8766D", lty=6,lwd=1.5)
abline(0,1,lty=3)
legend(.6,.3,lty = c(1,2,3,6),col=c("#C77CFF","#7CAE00","#00BFC4", "#F8766D"),c("SOFA Total","qSOFA Total","SIRS Total","FL/OD Pos+"),lwd=1.5)

plot(SOFA1ADJSepsis.Perf, main = "Comparison of Total Scores Sepsis Adjusted Prediction",col="#C77CFF",lty=1,lwd=1.5)
plot(qSOFA1ADJSepsis.Perf, add = TRUE,col="#7CAE00",lty=2,lwd=1.5)
plot(SIRS1ADJSepsis.Perf, add = TRUE ,col="#00BFC4", lty=3,lwd=1.5)
abline(0,1,lty=3)
legend(.6,.3,lty = c(1,2,3),col=c("#C77CFF","#7CAE00","#00BFC4","blue"),c("SOFA Total","qSOFA Total","SIRS Total"),lwd=1.5)

plot(SOFA1CrudeSepsis.Perf, main = "Comparison of SOFA Total Score versus 
     Fuzzy Logic Criteria Met Sepsis Crude Prediction",col="#C77CFF",lty=1,lwd=1.5)
plot(FuzzyLogicCrudeSepsis.Perf, add=TRUE, col="#F8766D", lty=6,lwd=1.5)
abline(0,1,lty=3)
legend(.6,.3,lty = c(1,6),col=c("#C77CFF","#F8766D"),c("SOFA Total", "FL/OD Pos+"),lwd=1.5)

plot(SOFA2CrudeSepsis.Perf, main = "Comparison of SOFA Positive Score versus 
     Fuzzy Logic Criteria Met Sepsis Crude Prediction",col="#C77CFF",lty=1,lwd=1.5)
plot(FuzzyLogicCrudeSepsis.Perf, add=TRUE, col="#F8766D", lty=6,lwd=1.5)
abline(0,1,lty=3)
legend(.6,.3,lty = c(1,6),col=c("#C77CFF","#F8766D"),c("SOFA Positive", "FL/OD Pos+"),lwd=1.5)

plot(SOFA2CrudeSepsis.Perf, main = "Comparison of SOFA Scores versus 
     Fuzzy Logic Criteria Met Sepsis Crude Prediction",col="#C77CFF",lty=1,lwd=1.5)
plot(SOFA1CrudeSepsis.Perf,add=TRUE, col= "darkgrey", lty=2,lwd=1.5)
plot(FuzzyLogicCrudeSepsis.Perf, add=TRUE, col="#F8766D", lty=6,lwd=1.5)
abline(0,1,lty=3)
legend(.6,.3,lty = c(1,2,6),col=c("#C77CFF", "darkgrey", "#F8766D"),c("SOFA Positive", "SOFA Total", "FL/OD Pos+"),lwd=1.5)

plot(SOFA1ADJSepsis.Perf, main = "Comparison of Total SOFA Score versus 
     Fuzzy Logic Criteria Met Sepsis Adjusted Prediction",col="#C77CFF",lty=1,lwd=1.5)
plot(FuzzyLogicADJSepsis.Perf, add=TRUE, col="#F8766D", lty=6,lwd=1.5)
abline(0,1,lty=3)
legend(.6,.3,lty = c(1,6),col=c("#C77CFF","#F8766D"),c("SOFA Total","FL/OD Pos+"),lwd=1.5)

plot(SOFA2ADJSepsis.Perf, main = "Comparison of Positive SOFA Score versus 
     Fuzzy Logic Criteria Met Sepsis Adjusted Prediction",col="#C77CFF",lty=1,lwd=1.5)
plot(FuzzyLogicADJSepsis.Perf, add=TRUE, col="#F8766D", lty=6,lwd=1.5)
abline(0,1,lty=3)
legend(.6,.3,lty = c(1,6),col=c("#C77CFF","#F8766D"),c("SOFA Pos+","FL/OD Pos+"),lwd=1.5)

plot(SOFA2ADJSepsis.Perf, main = "Comparison of SOFA Scores versus 
     Fuzzy Logic Criteria Met Sepsis Adjusted Prediction",col="#C77CFF",lty=1,lwd=1.5)
plot(SOFA1ADJSepsis.Perf,add=TRUE, col= "darkgrey", lty=2,lwd=1.5)
plot(FuzzyLogicADJSepsis.Perf, add=TRUE, col="#F8766D", lty=6,lwd=1.5)
abline(0,1,lty=3)
legend(.6,.3,lty = c(1,2,6),col=c("#C77CFF", "darkgrey", "#F8766D"),c("SOFA Positive", "SOFA Total", "FL/OD Pos+"),lwd=1.5)

plot(SOFA1CrudeMort.Perf, main = "Comparison of SOFA Total Scores versus 
     Fuzzy Logic Criteria Met Mortality Crude Prediction",col="#C77CFF",lty=1,lwd=1.5)
plot(FuzzyLogicCrudeMort.Perf, add=TRUE, col="#F8766D", lty=6,lwd=1.5)
abline(0,1,lty=3)
legend(.6,.3,lty = c(1,6),col=c("#C77CFF","#F8766D"),c("SOFA Total", "FL/OD Pos+"))

plot(SOFA2CrudeMort.Perf, main = "Comparison of SOFA Positive Score versus 
     Fuzzy Logic Criteria Met Mortality Crude Prediction",col="#C77CFF",lty=1,lwd=1.5)
plot(FuzzyLogicCrudeMort.Perf, add=TRUE, col="#F8766D", lty=6,lwd=1.5)
abline(0,1,lty=3)
legend(.6,.3,lty = c(1,6),col=c("#C77CFF","#F8766D"),c("SOFA Positive", "FL/OD Pos+"),lwd=1.5)

plot(SOFA2CrudeMort.Perf, main = "Comparison of SOFA Scores versus 
     Fuzzy Logic Criteria Met Mortality Crude Prediction",col="#C77CFF",lty=1,lwd=1.5)
plot(SOFA1CrudeMort.Perf,add=TRUE, col= "darkgrey", lty=2,lwd=1.5)
plot(FuzzyLogicCrudeMort.Perf, add=TRUE, col="#F8766D", lty=6,lwd=1.5)
abline(0,1,lty=3)
legend(.6,.3,lty = c(1,2,6),col=c("#C77CFF","darkgrey", "#F8766D"),c("SOFA Positive", "SOFA Total", "FL/OD Pos+"),lwd=1.5)

plot(SOFA1ADJMort.Perf, main = "Comparison of SOFA Total Score versus 
     Fuzzy Logic Criteria Met Mortality Adjusted Prediction",col="#C77CFF",lty=1,lwd=1.5)
plot(FuzzyLogicADJMort.Perf, add=TRUE, col="#F8766D", lty=6,lwd=1.5)
abline(0,1,lty=3)
legend(.6,.3,lty = c(1,6),col=c("#C77CFF", "#F8766D"),c("SOFA Total", "FL/OD Pos+"),lwd=1.5)

plot(SOFA2ADJMort.Perf, main = "Comparison of SOFA Positive Scores versus 
     Fuzzy Logic Criteria Met Mortality Adjusted Prediction",col="#C77CFF",lty=1,lwd=1.5)
plot(FuzzyLogicADJMort.Perf, add=TRUE, col="#F8766D", lty=6,lwd=1.5)
abline(0,1,lty=3)
legend(.6,.3,lty = c(1,6),col=c("#C77CFF", "#F8766D"),c("SOFA Positive", "FL/OD Pos+"),lwd=1.5)

plot(SOFA2ADJMort.Perf, main = "Comparison of SOFA Scores versus 
     Fuzzy Logic Criteria Met Mortality Adjusted Prediction",col="#C77CFF",lty=1,lwd=1.5)
plot(SOFA1ADJMort.Perf,add=TRUE, col= "darkgrey", lty=2,lwd=1.5)
plot(FuzzyLogicADJMort.Perf, add=TRUE, col="#F8766D", lty=6,lwd=1.5)
abline(0,1,lty=3)
legend(.6,.3,lty = c(1,2,6),col=c("#C77CFF", "darkgrey", "#F8766D"),c("SOFA Positive", "SOFA Total", "FL/OD Pos+"),lwd=1.5)

library(ggplot2)

levels(ORFuzzyLogicsepsis_Table3$BaselineDec)<-seq(1,10)
levels(ORSOFAsepsis_Table3$BaselineDec)<-seq(1,10)


ORTable3<-ORFuzzyLogicsepsis_Table3%>%bind_rows(ORSOFAsepsis_Table3)
ggplot(ORTable3,aes(BaselineDec,OddsRatio, group=type,col=type))+geom_point(aes(shape=type),size=3,position = position_dodge(width = 0.5))+geom_errorbar(aes(ymax=UL, ymin=LL),width=0.3,position = position_dodge(width = 0.5))+xlab("Baseline Sepsis Deciles")+ylab("Odds Ratio")+  theme(legend.title=element_blank()) + theme(axis.title=element_text(size=16,face="bold"),legend.text=element_text(size=12))+ggtitle("Outcome: Sepsis") +  scale_color_manual(values=c("#F8766D",  "#C77CFF")) + scale_shape_manual(values=c(15,4))

ORTable3<-ORFuzzyLogicsepsis_Table3%>%bind_rows(ORSOFAsepsis_Table3)
ggplot(ORTable3,aes(BaselineDec,OddsRatio, group=type,col=type))+geom_point(aes(shape=type),size=3,position = position_dodge(width = 0.5))+geom_errorbar(aes(ymax=UL, ymin=LL),width=0.3,position = position_dodge(width = 0.5))+xlab("Baseline Sepsis Deciles")+ylab("Odds Ratio")+  theme(legend.title=element_blank()) + theme(axis.title=element_text(size=16,face="bold"),legend.text=element_text(size=12))+ggtitle("Outcome: Sepsis") +  scale_color_manual(values=c("#F8766D",  "#C77CFF")) + scale_y_log10()  +  scale_shape_manual(values=c(15,4))

levels(ORFuzzyLogicmort_Table3$BaselineDec)<-seq(1,10)
levels(ORSOFAmort_Table3$BaselineDec)<-seq(1,10)

ORmortTable3<-ORFuzzyLogicmort_Table3%>%bind_rows(ORSOFAmort_Table3)
ggplot(ORmortTable3,aes(BaselineDec,OddsRatio, group=type,col=type))+geom_point(aes(shape=type),size=3,position = position_dodge(width = 0.5))+geom_errorbar(aes(ymax=UL, ymin=LL),width=0.3,position = position_dodge(width = 0.5))+xlab("Baseline Mortality Deciles")+ylab("Odds Ratio")+  theme(legend.title=element_blank()) + theme(axis.title=element_text(size=16,face="bold"),legend.text=element_text(size=12)) +ggtitle("Outcome: Mortality")  + scale_color_manual(values=c("#F8766D",  "#C77CFF")) + scale_shape_manual(values=c(15,4))

ORmortTable3<-ORFuzzyLogicmort_Table3%>%bind_rows(ORSOFAmort_Table3)
ggplot(ORmortTable3,aes(BaselineDec,OddsRatio, group=type,col=type))+geom_point(aes(shape=type),size=3,position = position_dodge(width = 0.5))+geom_errorbar(aes(ymax=UL, ymin=LL),width=0.3,position = position_dodge(width = 0.5))+xlab("Baseline Mortality Deciles")+ylab("Odds Ratio")+  theme(legend.title=element_blank()) + theme(axis.title=element_text(size=16,face="bold"),legend.text=element_text(size=12)) +ggtitle("Outcome: Mortality") + scale_y_log10() +scale_color_manual(values=c("#F8766D",  "#C77CFF")) + scale_shape_manual(values=c(15,4))

#save.image("PaperImageComplete.rdata")